Skip to content

Commit a42be58

Browse files
committed
resolve conflicts, keep local changes
1 parent fc56fac commit a42be58

48 files changed

Lines changed: 3049 additions & 1566 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/agent-release.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Release Agent
22

33
on:
44
push:
@@ -22,7 +22,9 @@ jobs:
2222
is-new-version: ${{ steps.check-package-version.outputs.is-new-version }}
2323
steps:
2424
- name: Checkout repository
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v6
26+
with:
27+
persist-credentials: false
2628

2729
- name: Check package version and detect an update
2830
id: check-package-version
@@ -40,12 +42,18 @@ jobs:
4042
id-token: write
4143
steps:
4244
- name: Checkout repository
43-
uses: actions/checkout@v4
45+
uses: actions/checkout@v6
46+
with:
47+
persist-credentials: false
48+
49+
- name: Setup pnpm
50+
uses: pnpm/action-setup@v4
4451

4552
- name: Set up Node 24
4653
uses: actions/setup-node@v4
4754
with:
4855
node-version: 24
56+
cache: "pnpm"
4957
registry-url: https://registry.npmjs.org
5058

5159
- name: Install pnpm
@@ -54,12 +62,18 @@ jobs:
5462
- name: Setup Bun
5563
uses: oven-sh/setup-bun@v2
5664

65+
- name: Setup Bun
66+
uses: oven-sh/setup-bun@v2
67+
5768
- name: Install dependencies
5869
run: pnpm install --frozen-lockfile
5970

6071
- name: Build the package
6172
run: pnpm --filter agent run build
6273

74+
- name: Run tests
75+
run: pnpm --filter agent run test
76+
6377
- name: Publish the package to npm registry
6478
working-directory: packages/agent
6579
run: pnpm publish --access public
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Release Array
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "apps/array/**"
9+
- "packages/agent/**"
10+
- "packages/electron-trpc/**"
11+
- "pnpm-lock.yaml"
12+
- "package.json"
13+
- "turbo.json"
14+
- ".github/workflows/array-release.yml"
15+
16+
concurrency:
17+
group: array-release
18+
cancel-in-progress: false
19+
20+
jobs:
21+
publish:
22+
runs-on: macos-latest
23+
env:
24+
NODE_ENV: production
25+
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
26+
APPLE_ID: ${{ secrets.APPLE_ID }}
27+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
28+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
29+
APPLE_CODESIGN_CERT_BASE64: ${{ secrets.APPLE_CODESIGN_CERT_BASE64 }}
30+
APPLE_CODESIGN_CERT_PASSWORD: ${{ secrets.APPLE_CODESIGN_CERT_PASSWORD }}
31+
APPLE_CODESIGN_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_CODESIGN_KEYCHAIN_PASSWORD }}
32+
steps:
33+
- name: Get app token
34+
id: app-token
35+
uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc # v3
36+
with:
37+
app_id: ${{ secrets.GH_APP_ARRAY_RELEASER_APP_ID }}
38+
private_key: ${{ secrets.GH_APP_ARRAY_RELEASER_PRIVATE_KEY }}
39+
40+
- name: Checkout
41+
uses: actions/checkout@v6
42+
with:
43+
fetch-depth: 0
44+
token: ${{ steps.app-token.outputs.token }}
45+
persist-credentials: false
46+
47+
- name: Setup pnpm
48+
uses: pnpm/action-setup@v4
49+
50+
- name: Setup Node.js
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: 22
54+
cache: "pnpm"
55+
56+
- name: Compute version from git tags
57+
id: version
58+
run: |
59+
# Find the latest minor version tag (vX.Y format - exactly 2 parts)
60+
# These are manually created to mark new minor releases
61+
# Release tags (vX.Y.Z) are ignored for base version calculation
62+
LATEST_TAG=$(git tag --list 'v[0-9]*.[0-9]*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+$' | head -1)
63+
64+
# Fall back to vX.Y.0 format if no vX.Y tags exist (backward compat)
65+
if [ -z "$LATEST_TAG" ]; then
66+
LATEST_TAG=$(git tag --list 'v[0-9]*.[0-9]*.0' --sort=-v:refname | head -1)
67+
fi
68+
69+
if [ -z "$LATEST_TAG" ]; then
70+
echo "No version tag found. Create one with: git tag v0.15 && git push origin v0.15"
71+
exit 1
72+
fi
73+
74+
# Extract major.minor from tag
75+
VERSION_PART=${LATEST_TAG#v}
76+
MAJOR=$(echo "$VERSION_PART" | cut -d. -f1)
77+
MINOR=$(echo "$VERSION_PART" | cut -d. -f2)
78+
79+
# Count commits since the base tag
80+
PATCH=$(git rev-list "$LATEST_TAG"..HEAD --count)
81+
82+
if [ "$PATCH" -eq 0 ]; then
83+
echo "No commits since $LATEST_TAG. Nothing to release."
84+
exit 1
85+
fi
86+
87+
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
88+
echo "Version: $NEW_VERSION (from base tag $LATEST_TAG + $PATCH commits)"
89+
90+
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
91+
echo "base_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
92+
93+
- name: Set version in package.json
94+
env:
95+
APP_VERSION: ${{ steps.version.outputs.version }}
96+
run: |
97+
# Update package.json for the build (not committed)
98+
jq --arg v "$APP_VERSION" '.version = $v' apps/array/package.json > tmp.json && mv tmp.json apps/array/package.json
99+
echo "Set apps/array/package.json version to $APP_VERSION"
100+
101+
- name: Install dependencies
102+
run: pnpm install --frozen-lockfile
103+
104+
- name: Build electron-trpc package
105+
run: pnpm --filter @posthog/electron-trpc run build
106+
107+
- name: Build agent package
108+
run: pnpm --filter @posthog/agent run build
109+
110+
- name: Import code signing certificate
111+
if: env.APPLE_CODESIGN_IDENTITY != ''
112+
env:
113+
CERT_BASE64: ${{ env.APPLE_CODESIGN_CERT_BASE64 }}
114+
CERT_PASSWORD: ${{ env.APPLE_CODESIGN_CERT_PASSWORD }}
115+
KEYCHAIN_PASSWORD: ${{ env.APPLE_CODESIGN_KEYCHAIN_PASSWORD }}
116+
run: |
117+
if [ -z "$CERT_BASE64" ] || [ -z "$CERT_PASSWORD" ] || [ -z "$KEYCHAIN_PASSWORD" ]; then
118+
echo "Missing code signing certificate secrets"
119+
exit 1
120+
fi
121+
KEYCHAIN="$RUNNER_TEMP/codesign.keychain-db"
122+
echo "$CERT_BASE64" | base64 --decode > "$RUNNER_TEMP/certificate.p12"
123+
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN"
124+
security set-keychain-settings -lut 21600 "$KEYCHAIN"
125+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN"
126+
security import "$RUNNER_TEMP/certificate.p12" -k "$KEYCHAIN" -P "$CERT_PASSWORD" -T /usr/bin/codesign -T /usr/bin/security
127+
security list-keychains -d user -s "$KEYCHAIN" $(security list-keychains -d user | tr -d '"')
128+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN"
129+
rm "$RUNNER_TEMP/certificate.p12"
130+
131+
- name: Create tag
132+
env:
133+
APP_VERSION: ${{ steps.version.outputs.version }}
134+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
135+
REPOSITORY: ${{ github.repository }}
136+
run: |
137+
TAG="v$APP_VERSION"
138+
git tag -a "$TAG" -m "Release $TAG"
139+
git push "https://x-access-token:${GH_TOKEN}@github.com/$REPOSITORY" "$TAG"
140+
141+
- name: Build native modules
142+
run: pnpm --filter array run build-native
143+
144+
- name: Publish with Electron Forge
145+
env:
146+
APP_VERSION: ${{ steps.version.outputs.version }}
147+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
148+
run: pnpm --filter array run publish

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
contents: read
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v5
16+
uses: actions/checkout@v6
1717
with:
1818
persist-credentials: false
1919
- name: Setup pnpm

.github/workflows/code-quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Code quality
1+
name: Code Quality
22

33
on:
44
pull_request:
@@ -14,7 +14,7 @@ jobs:
1414
contents: read
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v5
17+
uses: actions/checkout@v6
1818
with:
1919
persist-credentials: false
2020

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
contents: read
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v5
17+
uses: actions/checkout@v6
1818
with:
1919
persist-credentials: false
2020

.github/workflows/typecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
contents: read
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v5
13+
uses: actions/checkout@v6
1414
with:
1515
persist-credentials: false
1616
- name: Setup pnpm

apps/array/src/main/services/agent/schemas.ts

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export type Credentials = z.infer<typeof credentialsSchema>;
1313
export const agentFrameworkSchema = z.enum(["claude", "codex"]);
1414
export type AgentFramework = z.infer<typeof agentFrameworkSchema>;
1515

16+
// Execution mode schema
17+
export const executionModeSchema = z.enum(["plan", "acceptEdits", "default"]);
18+
export type ExecutionMode = z.infer<typeof executionModeSchema>;
19+
1620
// Session config schema
1721
export const sessionConfigSchema = z.object({
1822
taskId: z.string(),
@@ -23,6 +27,7 @@ export const sessionConfigSchema = z.object({
2327
sdkSessionId: z.string().optional(),
2428
model: z.string().optional(),
2529
framework: agentFrameworkSchema.optional(),
30+
executionMode: executionModeSchema.optional(),
2631
});
2732

2833
export type SessionConfig = z.infer<typeof sessionConfigSchema>;
@@ -40,7 +45,7 @@ export const startSessionInput = z.object({
4045
autoProgress: z.boolean().optional(),
4146
model: z.string().optional(),
4247
framework: agentFrameworkSchema.optional().default("claude"),
43-
executionMode: z.enum(["plan"]).optional(),
48+
executionMode: z.enum(["plan", "acceptEdits", "default"]).optional(),
4449
runMode: z.enum(["local", "cloud"]).optional(),
4550
createPR: z.boolean().optional(),
4651
});
@@ -112,6 +117,12 @@ export const setModelInput = z.object({
112117
modelId: z.string(),
113118
});
114119

120+
// Set mode input
121+
export const setModeInput = z.object({
122+
sessionId: z.string(),
123+
modeId: z.enum(["plan", "default", "acceptEdits"]),
124+
});
125+
115126
// Subscribe to session events input
116127
export const subscribeSessionInput = z.object({
117128
sessionId: z.string(),
@@ -120,13 +131,51 @@ export const subscribeSessionInput = z.object({
120131
// Agent events
121132
export const AgentServiceEvent = {
122133
SessionEvent: "session-event",
134+
PermissionRequest: "permission-request",
123135
} as const;
124136

125137
export interface AgentSessionEventPayload {
126138
sessionId: string;
127139
payload: unknown;
128140
}
129141

142+
export interface PermissionOption {
143+
kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
144+
name: string;
145+
optionId: string;
146+
description?: string;
147+
}
148+
149+
export interface PermissionRequestPayload {
150+
sessionId: string;
151+
toolCallId: string;
152+
title: string;
153+
options: PermissionOption[];
154+
rawInput: unknown;
155+
}
156+
130157
export interface AgentServiceEvents {
131158
[AgentServiceEvent.SessionEvent]: AgentSessionEventPayload;
159+
[AgentServiceEvent.PermissionRequest]: PermissionRequestPayload;
132160
}
161+
162+
// Permission response input for tRPC
163+
export const respondToPermissionInput = z.object({
164+
sessionId: z.string(),
165+
toolCallId: z.string(),
166+
optionId: z.string(),
167+
// For multi-select mode: array of selected option IDs
168+
selectedOptionIds: z.array(z.string()).optional(),
169+
// For "Other" option: custom text input from user
170+
customInput: z.string().optional(),
171+
});
172+
173+
export type RespondToPermissionInput = z.infer<typeof respondToPermissionInput>;
174+
175+
// Permission cancellation input for tRPC
176+
export const cancelPermissionInput = z.object({
177+
sessionId: z.string(),
178+
toolCallId: z.string(),
179+
});
180+
181+
export type CancelPermissionInput = z.infer<typeof cancelPermissionInput>;

0 commit comments

Comments
 (0)