@zq-silk/yui 0.2.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +603 -133
- package/README.md +806 -31
- package/dist/agent/agent.js +2 -1
- package/dist/agent/argumentPolicy.js +3 -1
- package/dist/agent/launchEnvironment.js +106 -0
- package/dist/agent/managedRuntimeEnvironment.js +34 -0
- package/dist/brief/taskBrief.js +11 -1
- package/dist/cli/agentConfigurationPicker.js +287 -0
- package/dist/cli/commandCatalog.js +488 -60
- package/dist/cli/completion.js +146 -22
- package/dist/cli/helpRenderer.js +3 -1
- package/dist/cli/interactionCandidates.js +53 -15
- package/dist/cli/interactionPolicy.js +267 -30
- package/dist/cli/interactiveSelection.js +6 -2
- package/dist/cli/invocationRouter.js +5 -1
- package/dist/cli/operatorWizard.js +87 -0
- package/dist/cli/roleOptionCatalog.js +1 -0
- package/dist/cli/roleWizard.js +185 -21
- package/dist/cli/updateCommand.js +62 -19
- package/dist/cli/updateOrchestrator.js +539 -0
- package/dist/cli/updatePorts.js +1119 -0
- package/dist/cli/upgradeCommand.js +112 -0
- package/dist/cli.js +1420 -86
- package/dist/commands/agentCommands.js +146 -3
- package/dist/commands/configCommands.js +126 -0
- package/dist/commands/controllerCommands.js +365 -0
- package/dist/commands/globalRoleCommands.js +168 -126
- package/dist/commands/jobCommands.js +18 -8
- package/dist/commands/operatorCommands.js +159 -9
- package/dist/commands/profileCommands.js +203 -0
- package/dist/commands/projectCommands.js +650 -0
- package/dist/commands/roleConfiguration.js +85 -24
- package/dist/commands/roleRuntimeGuard.js +12 -0
- package/dist/commands/roleSkillValidation.js +47 -0
- package/dist/commands/taskActor.js +127 -0
- package/dist/commands/taskCommands.js +4201 -313
- package/dist/commands/taskCompletionGate.js +131 -0
- package/dist/commands/taskContextCommand.js +244 -30
- package/dist/commands/taskInputCommands.js +177 -59
- package/dist/commands/taskIntegrationCommands.js +303 -0
- package/dist/commands/taskOverviewCommand.js +363 -0
- package/dist/commands/taskRoleRuntimeStatus.js +125 -19
- package/dist/commands/textInput.js +15 -0
- package/dist/completion/completionInstaller.js +26 -22
- package/dist/config/yuiConfig.js +4 -3
- package/dist/context/dispatchContext.js +90 -38
- package/dist/context/roleSessionContext.js +119 -0
- package/dist/controller/claudeLifecycleHook.js +203 -0
- package/dist/controller/clientRuntime.js +408 -56
- package/dist/controller/codexLifecycleHook.js +108 -0
- package/dist/controller/controller.js +1089 -32
- package/dist/controller/domainIdentity.js +505 -0
- package/dist/controller/ephemeralResourceReaper.js +131 -0
- package/dist/controller/fileSchedulerStoreAdapter.js +2153 -103
- package/dist/controller/providerHookRunFence.js +127 -0
- package/dist/controller/resourceCleanupLinux.js +286 -0
- package/dist/controller/resourceInventory.js +531 -0
- package/dist/controller/resourceInventoryLinux.js +610 -0
- package/dist/controller/runtime.js +629 -10
- package/dist/controller/runtimeEventInbox.js +564 -0
- package/dist/controller/runtimeEventProcessor.js +248 -0
- package/dist/controller/runtimeLaunchCoordinator.js +477 -0
- package/dist/controller/sessionNotify.js +121 -78
- package/dist/coordination/deadlineScheduler.js +15 -0
- package/dist/coordination/mailboxScheduler.js +108 -0
- package/dist/coordination/workMailbox.js +329 -0
- package/dist/coordination/workMailboxQueue.js +86 -0
- package/dist/core/controllerClient.js +19 -5
- package/dist/core/controllerEndpoint.js +37 -0
- package/dist/core/controllerServer.js +218 -10
- package/dist/core/protocol.js +6 -2
- package/dist/decision/decision.js +2 -1
- package/dist/doctor/doctor.js +681 -32
- package/dist/domain/validation.js +53 -0
- package/dist/errors/cliError.js +5 -3
- package/dist/event/taskEvent.js +7 -3
- package/dist/execution/codexThreadNaming.js +160 -0
- package/dist/execution/executionGroup.js +579 -0
- package/dist/executor/agentAdapter.js +255 -40
- package/dist/executor/agentConfigurationCatalog.js +326 -0
- package/dist/executor/agentConfigurationProbe.js +506 -0
- package/dist/executor/agentExecutor.js +625 -10
- package/dist/executor/codexConfigConflict.js +290 -0
- package/dist/executor/effectiveLaunch.js +340 -0
- package/dist/executor/executorRegistry.js +238 -36
- package/dist/executor/fileRoleLaunchPlanner.js +550 -40
- package/dist/executor/turnCompletion.js +126 -0
- package/dist/input/inputRequest.js +30 -9
- package/dist/integration/changeSet.js +36 -0
- package/dist/integration/checkResult.js +24 -0
- package/dist/integration/gitIntegrationService.js +695 -0
- package/dist/integration/integrationAttempt.js +142 -0
- package/dist/interaction/operatorPresentation.js +96 -0
- package/dist/lifecycle/canonicalLifecycleEvent.js +342 -0
- package/dist/lifecycle/exactRunTerminalization.js +572 -0
- package/dist/lifecycle/providerLifecycleMapping.js +190 -0
- package/dist/lifecycle/taskRoleSessionReset.js +124 -0
- package/dist/message/message.js +23 -7
- package/dist/milestone/milestone.js +2 -1
- package/dist/operator/operatorSessionHistory.js +124 -0
- package/dist/output/agentConfigurationPresentation.js +43 -0
- package/dist/output/rolePresentation.js +34 -10
- package/dist/output/terminal.js +8 -0
- package/dist/output/timePresentation.js +55 -0
- package/dist/profile/agentProfile.js +128 -0
- package/dist/repository/gitWorkspace.js +578 -24
- package/dist/repository/project.js +213 -0
- package/dist/repository/taskWorkspaceCoordinator.js +392 -0
- package/dist/repository/taskWorkspacePreparer.js +1688 -191
- package/dist/review/reviewConfig.js +11 -0
- package/dist/review/reviewRound.js +399 -0
- package/dist/review/taskFinalReviewContract.js +90 -0
- package/dist/role/role.js +124 -23
- package/dist/run/agentRun.js +155 -12
- package/dist/run/runIdentity.js +82 -0
- package/dist/runtime/exactControlPlane.js +472 -0
- package/dist/runtime/index.js +8 -0
- package/dist/runtime/lifecycleReservation.js +38 -0
- package/dist/runtime/ports.js +11 -0
- package/dist/runtime/preallocatedNativeSession.js +13 -0
- package/dist/runtime/promptEnvelope.js +30 -0
- package/dist/runtime/runtimeBinding.js +31 -0
- package/dist/runtime/runtimeOwner.js +14 -0
- package/dist/runtime/sessionLaunchRequest.js +62 -0
- package/dist/runtime/sessionTitle.js +54 -0
- package/dist/runtime/taskRuntimeIsolation.js +643 -0
- package/dist/runtime/tmuxAdapters.js +315 -0
- package/dist/runtime/turnCompletion.js +3 -0
- package/dist/runtime/validation.js +23 -0
- package/dist/scheduler/activeRoleRunDelivery.js +342 -32
- package/dist/scheduler/activeTaskProgress.js +63 -0
- package/dist/scheduler/leaderFailure.js +2 -1
- package/dist/scheduler/leaderWakeupProcessor.js +307 -66
- package/dist/scheduler/operatorInputNotificationProcessor.js +109 -46
- package/dist/scheduler/operatorNotification.js +44 -2
- package/dist/scheduler/ports.js +28 -1
- package/dist/scheduler/roleRunLiveness.js +131 -25
- package/dist/scheduler/roleRunStall.js +951 -0
- package/dist/scheduler/taskExecutionProjection.js +544 -0
- package/dist/scheduler/wakeupQueue.js +3 -0
- package/dist/setup/setupCommand.js +302 -52
- package/dist/storage/compatibleTaskStore.js +102 -0
- package/dist/storage/migration/baseline.js +78 -0
- package/dist/storage/migration/classifier.js +51 -0
- package/dist/storage/migration/compatibleCodec.js +53 -0
- package/dist/storage/migration/engine.js +147 -0
- package/dist/storage/migration/index.js +33 -0
- package/dist/storage/migration/planner.js +154 -0
- package/dist/storage/migration/productionRegistry.js +486 -0
- package/dist/storage/migration/registry.js +169 -0
- package/dist/storage/migration/report.js +54 -0
- package/dist/storage/migration/types.js +31 -0
- package/dist/storage/storageSchema.js +147 -123
- package/dist/storage/storageVersions.js +11 -0
- package/dist/storage/taskStore.js +1793 -197
- package/dist/storage/upgrade/homeClassification.js +156 -0
- package/dist/storage/upgrade/homeMigrationTarget.js +595 -0
- package/dist/storage/upgrade/offlineUpgradeInventory.js +315 -0
- package/dist/storage/upgrade/productionMigrationRegistry.js +6 -0
- package/dist/storage/upgrade/recordVersionScan.js +176 -0
- package/dist/storage/upgrade/recordVersions.js +159 -0
- package/dist/storage/upgrade/switchProgress.js +80 -0
- package/dist/storage/upgrade/upgradeOrchestrator.js +948 -0
- package/dist/storage/upgrade/upgradeReceipt.js +161 -0
- package/dist/storage/upgradeCoordination.js +186 -0
- package/dist/storage/upgradeFence.js +366 -0
- package/dist/task/task.js +132 -26
- package/dist/task/taskRecordReference.js +66 -0
- package/dist/tmux/commandExecutor.js +75 -2
- package/dist/tmux/tmuxManager.js +747 -49
- package/dist/version.js +23 -0
- package/dist/web/assets/assetManifest.js +62 -0
- package/dist/web/assets/client/app.js +631 -0
- package/dist/web/assets/client/components.js +605 -0
- package/dist/web/assets/client/dom.js +14 -0
- package/dist/web/assets/client/format.js +28 -0
- package/dist/web/assets/client/i18n.js +494 -0
- package/dist/web/assets/client/markdown.js +114 -0
- package/dist/web/assets/client/theme.js +32 -0
- package/dist/web/assets/client/view.js +458 -0
- package/dist/web/assets/fontData.js +12 -0
- package/dist/web/assets/fonts.js +12 -0
- package/dist/web/assets/shell.js +114 -0
- package/dist/web/assets/styles/cards.js +135 -0
- package/dist/web/assets/styles/layout.js +47 -0
- package/dist/web/assets/styles/markdown.js +29 -0
- package/dist/web/assets/styles/responsive.js +39 -0
- package/dist/web/assets/styles/tokens.js +101 -0
- package/dist/web/assets/styles/widgets.js +147 -0
- package/dist/web/tmuxWebTerminal.js +158 -0
- package/dist/web/webServer.js +463 -0
- package/dist/web/webSnapshot.js +148 -0
- package/dist/workItem/workItem.js +642 -23
- package/dist/workspace/gitChangeSetCapture.js +86 -0
- package/dist/workspace/workItemChangeSetManager.js +445 -0
- package/dist/worktree/managedWorkspace.js +202 -0
- package/docs/task-local-identity.md +62 -0
- package/i18n/README.zh-CN.md +406 -31
- package/package.json +10 -2
- package/skills/yui-leader/SKILL.md +601 -39
- package/skills/yui-operator/SKILL.md +255 -34
- package/skills/yui-reviewer/SKILL.md +57 -0
- package/skills/yui-worker/SKILL.md +214 -17
- package/dist/commands/repositoryCommands.js +0 -86
- package/dist/operator/operatorContext.js +0 -66
- package/dist/repository/repository.js +0 -55
- package/dist/scheduler/archivedTaskRuntime.js +0 -12
- package/dist/worktree/roleWorkspace.js +0 -62
|
@@ -9,7 +9,49 @@ const taskTarget = (command, argumentIndex = 2, statuses) => ({
|
|
|
9
9
|
}]
|
|
10
10
|
});
|
|
11
11
|
export const INTERACTION_POLICIES = Object.freeze([
|
|
12
|
-
|
|
12
|
+
{
|
|
13
|
+
commandPath: ["project", "refresh"],
|
|
14
|
+
selectors: [{
|
|
15
|
+
argumentIndex: 2,
|
|
16
|
+
entity: "project",
|
|
17
|
+
provider: "projects",
|
|
18
|
+
actionTarget: true
|
|
19
|
+
}]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
commandPath: ["project", "update"],
|
|
23
|
+
selectors: [{
|
|
24
|
+
argumentIndex: 2,
|
|
25
|
+
entity: "project",
|
|
26
|
+
provider: "projects",
|
|
27
|
+
actionTarget: true
|
|
28
|
+
}],
|
|
29
|
+
trailingOptions: {
|
|
30
|
+
"--alias": "value",
|
|
31
|
+
"--clear-aliases": "flag",
|
|
32
|
+
"--remote": "value",
|
|
33
|
+
"--clear-remote": "flag",
|
|
34
|
+
"--stable": "value",
|
|
35
|
+
"--development": "value"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
...["add", "update", "retire", "list", "show"].map((command) => ({
|
|
39
|
+
commandPath: ["project", "knowledge", command],
|
|
40
|
+
selectors: [{
|
|
41
|
+
argumentIndex: 3,
|
|
42
|
+
entity: "project",
|
|
43
|
+
provider: "projects",
|
|
44
|
+
actionTarget: command !== "list"
|
|
45
|
+
}],
|
|
46
|
+
...(command === "add"
|
|
47
|
+
? { trailingOptions: { "--body": "value" } }
|
|
48
|
+
: command === "update"
|
|
49
|
+
? { trailingOptions: { "--title": "value", "--body": "value" } }
|
|
50
|
+
: command === "list"
|
|
51
|
+
? { trailingOptions: { "--all": "flag" } }
|
|
52
|
+
: {})
|
|
53
|
+
})),
|
|
54
|
+
...["show", "capabilities", "update", "remove"].map((command) => ({
|
|
13
55
|
commandPath: ["agent", command],
|
|
14
56
|
selectors: [{
|
|
15
57
|
argumentIndex: 2,
|
|
@@ -34,8 +76,9 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
34
76
|
"--agent": "value", "--workspace": "value", "--description": "value",
|
|
35
77
|
"--responsibility": "value", "--constraint": "value", "--expected-output": "value",
|
|
36
78
|
"--system-prompt": "value", "--skill": "value", "--model": "value",
|
|
37
|
-
"--effort": "value", "--sandbox": "value", "--approval": "value",
|
|
38
|
-
"--permission-mode": "value", "--
|
|
79
|
+
"--effort": "value", "--permission-strategy": "value", "--sandbox": "value", "--approval": "value",
|
|
80
|
+
"--permission-mode": "value", "--allowed-tool": "value", "--disallowed-tool": "value",
|
|
81
|
+
"--search": "value"
|
|
39
82
|
}
|
|
40
83
|
},
|
|
41
84
|
...["show", "update", "remove", "enter"].map((command) => ({
|
|
@@ -50,13 +93,13 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
50
93
|
? { confirmation: { action: "Remove Role", targetArgumentIndex: 2 } }
|
|
51
94
|
: {})
|
|
52
95
|
})),
|
|
53
|
-
{
|
|
54
|
-
commandPath: ["role",
|
|
96
|
+
...["bind", "unbind"].map((command) => ({
|
|
97
|
+
commandPath: ["role", command],
|
|
55
98
|
selectors: [
|
|
56
99
|
{ argumentIndex: 2, entity: "global-role", provider: "global-roles", actionTarget: true },
|
|
57
100
|
{ argumentIndex: 3, entity: "agent", provider: "configured-agents", actionTarget: false }
|
|
58
101
|
]
|
|
59
|
-
},
|
|
102
|
+
})),
|
|
60
103
|
...["record", "replace"].map((command) => ({
|
|
61
104
|
commandPath: ["role", "session", command],
|
|
62
105
|
selectors: [{
|
|
@@ -69,6 +112,36 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
69
112
|
? { "--native-id": "value", "--reason": "value" }
|
|
70
113
|
: { "--native-id": "value" }
|
|
71
114
|
})),
|
|
115
|
+
{
|
|
116
|
+
commandPath: ["profile", "add"],
|
|
117
|
+
selectors: [],
|
|
118
|
+
trailingOptions: {
|
|
119
|
+
"--description": "value", "--instructions": "value",
|
|
120
|
+
"--skill": "value", "--model": "value", "--effort": "value", "--access": "value"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
...["show", "update", "remove"].map((command) => ({
|
|
124
|
+
commandPath: ["profile", command],
|
|
125
|
+
selectors: [{
|
|
126
|
+
argumentIndex: 2,
|
|
127
|
+
entity: "agent-profile",
|
|
128
|
+
provider: "agent-profiles",
|
|
129
|
+
actionTarget: true
|
|
130
|
+
}],
|
|
131
|
+
...(command === "update"
|
|
132
|
+
? {
|
|
133
|
+
trailingOptions: {
|
|
134
|
+
"--description": "option-like-value",
|
|
135
|
+
"--instructions": "option-like-value", "--skill": "value",
|
|
136
|
+
"--model": "option-like-value", "--effort": "option-like-value",
|
|
137
|
+
"--access": "value"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
: {}),
|
|
141
|
+
...(command === "remove"
|
|
142
|
+
? { confirmation: { action: "Remove Agent Profile", targetArgumentIndex: 2 } }
|
|
143
|
+
: {})
|
|
144
|
+
})),
|
|
72
145
|
taskTarget("show"),
|
|
73
146
|
taskTarget("context"),
|
|
74
147
|
{
|
|
@@ -92,7 +165,22 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
92
165
|
},
|
|
93
166
|
taskTarget("reopen", 2, ["completed"]),
|
|
94
167
|
{
|
|
95
|
-
...taskTarget("
|
|
168
|
+
...taskTarget("retire", 2, ["draft", "active"]),
|
|
169
|
+
trailingOptions: {
|
|
170
|
+
"--summary": "value",
|
|
171
|
+
"--summary-file": "value",
|
|
172
|
+
"--replacement": "value"
|
|
173
|
+
},
|
|
174
|
+
confirmation: { action: "Retire task", targetArgumentIndex: 2 }
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
commandPath: ["task", "list"],
|
|
178
|
+
selectors: [],
|
|
179
|
+
trailingOptions: { "--all": "flag", "--verbose": "flag" }
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
...taskTarget("archive", 2, ["completed", "retired"]),
|
|
183
|
+
trailingOptions: { "--integrated": "flag", "--abandon": "flag" },
|
|
96
184
|
confirmation: { action: "Archive task", targetArgumentIndex: 2 }
|
|
97
185
|
},
|
|
98
186
|
taskTarget("reconcile"),
|
|
@@ -109,12 +197,12 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
109
197
|
{
|
|
110
198
|
commandPath: ["task", "create"],
|
|
111
199
|
selectors: [{
|
|
112
|
-
option: "--
|
|
113
|
-
entity: "
|
|
114
|
-
provider: "
|
|
200
|
+
option: "--project",
|
|
201
|
+
entity: "project",
|
|
202
|
+
provider: "projects",
|
|
115
203
|
actionTarget: false
|
|
116
204
|
}],
|
|
117
|
-
trailingOptions: { "--
|
|
205
|
+
trailingOptions: { "--project": "value", "--base": "value" }
|
|
118
206
|
},
|
|
119
207
|
...["send", "list"].map((command) => ({
|
|
120
208
|
commandPath: ["task", "message", command],
|
|
@@ -189,14 +277,20 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
189
277
|
commandPath: ["task", "role", "add"],
|
|
190
278
|
selectors: [
|
|
191
279
|
{ argumentIndex: 3, entity: "task", provider: "tasks", actionTarget: true },
|
|
192
|
-
{ option: "--
|
|
280
|
+
{ option: "--profile", entity: "agent-profile", provider: "agent-profiles", actionTarget: false },
|
|
281
|
+
{
|
|
282
|
+
option: "--agent",
|
|
283
|
+
entity: "agent",
|
|
284
|
+
provider: "configured-agents",
|
|
285
|
+
actionTarget: false
|
|
286
|
+
}
|
|
193
287
|
],
|
|
194
288
|
trailingOptions: {
|
|
195
|
-
"--agent": "value", "--description": "value", "--responsibility": "value",
|
|
289
|
+
"--profile": "value", "--agent": "value", "--description": "value", "--responsibility": "value",
|
|
196
290
|
"--constraint": "value", "--expected-output": "value", "--system-prompt": "value",
|
|
197
291
|
"--skill": "value", "--model": "value", "--effort": "value",
|
|
198
|
-
"--sandbox": "value", "--approval": "value", "--permission-mode": "value",
|
|
199
|
-
"--search": "value"
|
|
292
|
+
"--permission-strategy": "value", "--sandbox": "value", "--approval": "value", "--permission-mode": "value",
|
|
293
|
+
"--allowed-tool": "value", "--disallowed-tool": "value", "--search": "value"
|
|
200
294
|
}
|
|
201
295
|
},
|
|
202
296
|
{
|
|
@@ -213,14 +307,20 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
213
307
|
provider: "task-roles",
|
|
214
308
|
dependsOn: 3,
|
|
215
309
|
actionTarget: true
|
|
216
|
-
}
|
|
310
|
+
},
|
|
311
|
+
...(command === "update"
|
|
312
|
+
? [
|
|
313
|
+
{ option: "--profile", entity: "agent-profile", provider: "agent-profiles", actionTarget: false },
|
|
314
|
+
{ option: "--agent", entity: "agent", provider: "configured-agents", actionTarget: false }
|
|
315
|
+
]
|
|
316
|
+
: [])
|
|
217
317
|
],
|
|
218
318
|
...(command === "remove"
|
|
219
319
|
? { confirmation: { action: "Remove Task Role", targetArgumentIndex: 4 } }
|
|
220
320
|
: {})
|
|
221
321
|
})),
|
|
222
|
-
{
|
|
223
|
-
commandPath: ["task", "role",
|
|
322
|
+
...["bind", "unbind"].map((command) => ({
|
|
323
|
+
commandPath: ["task", "role", command],
|
|
224
324
|
selectors: [
|
|
225
325
|
{ argumentIndex: 3, entity: "task", provider: "tasks", actionTarget: true },
|
|
226
326
|
{
|
|
@@ -232,6 +332,21 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
232
332
|
},
|
|
233
333
|
{ argumentIndex: 5, entity: "agent", provider: "configured-agents", actionTarget: false }
|
|
234
334
|
]
|
|
335
|
+
})),
|
|
336
|
+
{
|
|
337
|
+
commandPath: ["task", "role", "reset"],
|
|
338
|
+
selectors: [
|
|
339
|
+
{ argumentIndex: 3, entity: "task", provider: "tasks", actionTarget: true, statuses: ["active"] },
|
|
340
|
+
{
|
|
341
|
+
argumentIndex: 4,
|
|
342
|
+
entity: "task-role",
|
|
343
|
+
provider: "task-roles",
|
|
344
|
+
dependsOn: 3,
|
|
345
|
+
actionTarget: true
|
|
346
|
+
}
|
|
347
|
+
],
|
|
348
|
+
trailingOptions: { "--reason": "value" },
|
|
349
|
+
confirmation: { action: "Reset Task Role Session", targetArgumentIndex: 4 }
|
|
235
350
|
},
|
|
236
351
|
{
|
|
237
352
|
commandPath: ["task", "role", "enter"],
|
|
@@ -258,30 +373,152 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
258
373
|
actionTarget: false
|
|
259
374
|
}
|
|
260
375
|
],
|
|
261
|
-
trailingOptions: {
|
|
376
|
+
trailingOptions: {
|
|
377
|
+
"--objective": "value", "--accept": "value", "--after": "value", "--role": "value"
|
|
378
|
+
}
|
|
262
379
|
},
|
|
263
380
|
{
|
|
264
381
|
commandPath: ["task", "work", "list"],
|
|
265
382
|
selectors: [{ argumentIndex: 3, entity: "task", provider: "tasks", actionTarget: true }]
|
|
266
383
|
},
|
|
384
|
+
...["show", "update", "dispatch", "isolate", "capture", "cleanup", "accept", "reject"]
|
|
385
|
+
.map((command) => ({
|
|
386
|
+
commandPath: ["task", "work", command],
|
|
387
|
+
selectors: [{
|
|
388
|
+
argumentIndex: 3,
|
|
389
|
+
entity: "work-item",
|
|
390
|
+
provider: "work-items",
|
|
391
|
+
actionTarget: true
|
|
392
|
+
}],
|
|
393
|
+
...(command === "update"
|
|
394
|
+
? { trailingOptions: { "--summary": "value" } }
|
|
395
|
+
: command === "dispatch"
|
|
396
|
+
? { trailingOptions: { "--input": "value" } }
|
|
397
|
+
: command === "cleanup"
|
|
398
|
+
? {
|
|
399
|
+
trailingOptions: {
|
|
400
|
+
"--integrated": "flag",
|
|
401
|
+
"--abandon": "flag"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
: ["accept", "reject"].includes(command)
|
|
405
|
+
? { trailingOptions: { "--summary": "value" } }
|
|
406
|
+
: {})
|
|
407
|
+
})),
|
|
267
408
|
{
|
|
268
|
-
commandPath: ["task", "work", "
|
|
269
|
-
selectors: [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
409
|
+
commandPath: ["task", "work", "retire"],
|
|
410
|
+
selectors: [
|
|
411
|
+
{
|
|
412
|
+
argumentIndex: 3,
|
|
413
|
+
entity: "work-item",
|
|
414
|
+
provider: "work-items",
|
|
415
|
+
actionTarget: true
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
option: "--replacement",
|
|
419
|
+
entity: "work-item",
|
|
420
|
+
provider: "work-items",
|
|
421
|
+
dependsOn: 3,
|
|
422
|
+
actionTarget: false
|
|
423
|
+
}
|
|
424
|
+
],
|
|
425
|
+
trailingOptions: { "--summary": "value", "--replacement": "value" },
|
|
426
|
+
confirmation: { action: "Retire Work Item", targetArgumentIndex: 3 }
|
|
276
427
|
},
|
|
277
428
|
{
|
|
278
429
|
commandPath: ["task", "run", "list"],
|
|
279
|
-
selectors: [{ argumentIndex: 3, entity: "work-item", provider: "work-items", actionTarget: true }]
|
|
430
|
+
selectors: [{ argumentIndex: 3, entity: "work-item", provider: "work-items", actionTarget: true }],
|
|
280
431
|
},
|
|
281
432
|
...["retry", "yield"].map((command) => ({
|
|
282
433
|
commandPath: ["task", "run", command],
|
|
283
|
-
selectors: [{
|
|
284
|
-
|
|
434
|
+
selectors: [{
|
|
435
|
+
argumentIndex: 3,
|
|
436
|
+
entity: "run",
|
|
437
|
+
provider: "runs",
|
|
438
|
+
actionTarget: true
|
|
439
|
+
}],
|
|
440
|
+
...(command === "yield"
|
|
441
|
+
? { trailingOptions: { "--summary": "value" } }
|
|
442
|
+
: {})
|
|
443
|
+
})),
|
|
444
|
+
{
|
|
445
|
+
commandPath: ["task", "work", "group", "resolve"],
|
|
446
|
+
selectors: [{
|
|
447
|
+
argumentIndex: 4,
|
|
448
|
+
entity: "work-item",
|
|
449
|
+
provider: "work-items",
|
|
450
|
+
actionTarget: true
|
|
451
|
+
}],
|
|
452
|
+
trailingOptions: {
|
|
453
|
+
"--decision": "value",
|
|
454
|
+
"--summary": "value",
|
|
455
|
+
"--lane": "value"
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
commandPath: ["task", "review", "request"],
|
|
460
|
+
selectors: [
|
|
461
|
+
{
|
|
462
|
+
argumentIndex: 3,
|
|
463
|
+
entity: "task",
|
|
464
|
+
provider: "tasks",
|
|
465
|
+
actionTarget: true,
|
|
466
|
+
statuses: ["active"]
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
option: "--role",
|
|
470
|
+
entity: "global-role",
|
|
471
|
+
provider: "global-roles",
|
|
472
|
+
actionTarget: false
|
|
473
|
+
}
|
|
474
|
+
],
|
|
475
|
+
trailingOptions: { "--role": "value", "--strategy": "value", "--lane-role": "value" }
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
commandPath: ["task", "integration", "start"],
|
|
479
|
+
selectors: [
|
|
480
|
+
{ argumentIndex: 3, entity: "task", provider: "tasks", actionTarget: true },
|
|
481
|
+
{
|
|
482
|
+
option: "--change-set",
|
|
483
|
+
requiredOption: true,
|
|
484
|
+
entity: "change-set",
|
|
485
|
+
provider: "change-sets",
|
|
486
|
+
dependsOn: 3,
|
|
487
|
+
actionTarget: false
|
|
488
|
+
}
|
|
489
|
+
],
|
|
490
|
+
trailingOptions: { "--change-set": "value", "--target": "value", "--check": "value" }
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
commandPath: ["task", "integration", "list"],
|
|
494
|
+
selectors: [{ argumentIndex: 3, entity: "task", provider: "tasks", actionTarget: true }]
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
commandPath: ["task", "integration", "cleanup"],
|
|
498
|
+
selectors: [{
|
|
499
|
+
argumentIndex: 3,
|
|
500
|
+
entity: "integration-attempt",
|
|
501
|
+
provider: "integration-attempts",
|
|
502
|
+
actionTarget: true,
|
|
503
|
+
statuses: ["committed", "failed"]
|
|
504
|
+
}]
|
|
505
|
+
},
|
|
506
|
+
...["show", "continue", "resolve", "abort"].map((command) => ({
|
|
507
|
+
commandPath: ["task", "integration", command],
|
|
508
|
+
selectors: [{
|
|
509
|
+
argumentIndex: 3,
|
|
510
|
+
entity: "integration-attempt",
|
|
511
|
+
provider: "integration-attempts",
|
|
512
|
+
actionTarget: true,
|
|
513
|
+
...(command === "continue" ? { statuses: ["blocked", "validating"] } : {}),
|
|
514
|
+
...(command === "resolve" ? { statuses: ["blocked"] } : {}),
|
|
515
|
+
...(command === "abort" ? { statuses: ["running", "blocked"] } : {})
|
|
516
|
+
}],
|
|
517
|
+
...(command === "resolve"
|
|
518
|
+
? { trailingOptions: { "--option": "value", "--rationale": "value" } }
|
|
519
|
+
: command === "abort"
|
|
520
|
+
? { trailingOptions: { "--reason": "value" } }
|
|
521
|
+
: {})
|
|
285
522
|
})),
|
|
286
523
|
{
|
|
287
524
|
commandPath: ["task", "enter"],
|
|
@@ -92,11 +92,13 @@ function interactionPrerequisitesReady(args, node, policy) {
|
|
|
92
92
|
if (token.startsWith("--")) {
|
|
93
93
|
const optionIndex = args.indexOf(token);
|
|
94
94
|
const next = tail[index + 1];
|
|
95
|
-
|
|
95
|
+
const selectable = policy?.selectors.some((selector) => selector.option === token) === true
|
|
96
|
+
|| Object.hasOwn(node.optionValues, token);
|
|
97
|
+
if (optionIndex < 0 && !selectable)
|
|
96
98
|
return false;
|
|
97
99
|
if (next?.startsWith("<") === true) {
|
|
98
100
|
const value = args[optionIndex + 1];
|
|
99
|
-
if (value === undefined || value.startsWith("--"))
|
|
101
|
+
if ((value === undefined || value.startsWith("--")) && !selectable)
|
|
100
102
|
return false;
|
|
101
103
|
index += 1;
|
|
102
104
|
}
|
|
@@ -116,6 +118,8 @@ function interactionPrerequisitesReady(args, node, policy) {
|
|
|
116
118
|
const optionIndex = args.indexOf(option);
|
|
117
119
|
if (optionIndex < 0)
|
|
118
120
|
continue;
|
|
121
|
+
if (policy?.trailingOptions?.[option] === "flag")
|
|
122
|
+
continue;
|
|
119
123
|
const value = args[optionIndex + 1];
|
|
120
124
|
const selectable = policy?.selectors.some((selector) => selector.option === option) === true
|
|
121
125
|
|| Object.hasOwn(node.optionValues, option);
|
|
@@ -30,7 +30,11 @@ function resolveExecutionPath(args) {
|
|
|
30
30
|
if (node.kind === "leaf")
|
|
31
31
|
break;
|
|
32
32
|
const child = findChild(node, args[index] ?? "");
|
|
33
|
-
|
|
33
|
+
const internalExecutable = child !== undefined && ((node === ROOT_COMMAND && child.name === "internal")
|
|
34
|
+
|| (node.path.join(" ") === "yui completion" && child.name === "candidates")
|
|
35
|
+
|| (node.path.join(" ") === "yui task run" && child.name === "checkpoint")
|
|
36
|
+
|| (node.path.join(" ") === "yui controller" && child.name === "identity"));
|
|
37
|
+
if (child === undefined || (child.hidden && !internalExecutable)) {
|
|
34
38
|
if (node.kind === "hybrid" && node.acceptsArguments)
|
|
35
39
|
break;
|
|
36
40
|
return {
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { renderTable } from "../output/table.js";
|
|
2
|
+
import { formatRelativeTimestamp } from "../output/timePresentation.js";
|
|
3
|
+
export async function resolveOperatorWizardArguments(commandArgs, role, sessions, io, now = new Date()) {
|
|
4
|
+
const args = [...commandArgs];
|
|
5
|
+
if (!io.interactive || io.json || role === null || args[0] !== "operator") {
|
|
6
|
+
return { kind: "unchanged", args };
|
|
7
|
+
}
|
|
8
|
+
if (args[1] === "new" && args.length === 2) {
|
|
9
|
+
const bindings = Object.values(role.agentBindings);
|
|
10
|
+
if (bindings.length === 0)
|
|
11
|
+
return { kind: "unchanged", args };
|
|
12
|
+
const selected = bindings.length === 1
|
|
13
|
+
? bindings[0]?.agentId
|
|
14
|
+
: await choose("Select Operator Agent", bindings.map((binding) => ({
|
|
15
|
+
value: binding.agentId,
|
|
16
|
+
cells: [
|
|
17
|
+
adapterLabel(binding.adapterId),
|
|
18
|
+
binding.agentId,
|
|
19
|
+
binding.agentId === role.activeAgentId ? "active" : "bound"
|
|
20
|
+
]
|
|
21
|
+
})), [
|
|
22
|
+
{ header: "Adapter", minWidth: 7, maxWidth: 12 },
|
|
23
|
+
{ header: "Agent", minWidth: 6, maxWidth: 24 },
|
|
24
|
+
{ header: "State", minWidth: 6, maxWidth: 8 }
|
|
25
|
+
], io, role.activeAgentId, "Agent");
|
|
26
|
+
return selected === undefined
|
|
27
|
+
? { kind: "cancelled", args }
|
|
28
|
+
: { kind: "resolved", args: [...args, "--agent", selected] };
|
|
29
|
+
}
|
|
30
|
+
if (args[1] === "resume" && args.length === 2) {
|
|
31
|
+
const newSession = "__operator_new_session__";
|
|
32
|
+
const selected = await choose("Resume an Operator session", [
|
|
33
|
+
...sessions.map((session) => ({
|
|
34
|
+
value: session.ref,
|
|
35
|
+
cells: [
|
|
36
|
+
formatRelativeTimestamp(session.updatedAt, now),
|
|
37
|
+
adapterLabel(session.adapterId),
|
|
38
|
+
session.displayTitle,
|
|
39
|
+
session.state
|
|
40
|
+
]
|
|
41
|
+
})),
|
|
42
|
+
{
|
|
43
|
+
value: newSession,
|
|
44
|
+
cells: ["", "", "Start a new session", "new"]
|
|
45
|
+
}
|
|
46
|
+
], [
|
|
47
|
+
{ header: "Updated", minWidth: 7, maxWidth: 12 },
|
|
48
|
+
{ header: "Agent", minWidth: 6, maxWidth: 12 },
|
|
49
|
+
{ header: "Conversation", minWidth: 20, maxWidth: 64 },
|
|
50
|
+
{ header: "State", minWidth: 7, maxWidth: 10 }
|
|
51
|
+
], io, sessions[0]?.ref ?? newSession, "session");
|
|
52
|
+
if (selected === newSession) {
|
|
53
|
+
return resolveOperatorWizardArguments(["operator", "new"], role, sessions, io, now);
|
|
54
|
+
}
|
|
55
|
+
return selected === undefined
|
|
56
|
+
? { kind: "cancelled", args }
|
|
57
|
+
: { kind: "resolved", args: [...args, selected] };
|
|
58
|
+
}
|
|
59
|
+
return { kind: "unchanged", args };
|
|
60
|
+
}
|
|
61
|
+
async function choose(title, choices, columns, io, defaultValue, label) {
|
|
62
|
+
if (choices.length === 0) {
|
|
63
|
+
io.write("○ No Operator sessions are available.\n");
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
io.write(`${renderTable(title, [{ header: "#", minWidth: 1, maxWidth: 4 }, ...columns], choices.map((choice, index) => [String(index + 1), ...choice.cells]), io.width)}\n\n`);
|
|
67
|
+
const answer = (await io.question(`Choose ${label} [1-${choices.length}/value, q]: `))?.trim();
|
|
68
|
+
if (answer === undefined || answer.toLowerCase() === "q" || answer.toLowerCase() === "quit") {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
if (answer.length === 0) {
|
|
72
|
+
return choices.find((choice) => choice.value === defaultValue)?.value
|
|
73
|
+
?? choices[0]?.value;
|
|
74
|
+
}
|
|
75
|
+
const index = Number(answer);
|
|
76
|
+
if (Number.isSafeInteger(index) && index >= 1 && index <= choices.length) {
|
|
77
|
+
return choices[index - 1]?.value;
|
|
78
|
+
}
|
|
79
|
+
return choices.find((choice) => choice.value === answer)?.value;
|
|
80
|
+
}
|
|
81
|
+
function adapterLabel(adapterId) {
|
|
82
|
+
return adapterId === "codex"
|
|
83
|
+
? "Codex"
|
|
84
|
+
: adapterId === "claude"
|
|
85
|
+
? "Claude"
|
|
86
|
+
: adapterId;
|
|
87
|
+
}
|
|
@@ -4,6 +4,7 @@ const CLAUDE_ONLY = Object.freeze(["claude"]);
|
|
|
4
4
|
export const ROLE_AGENT_OPTION_SPECS = Object.freeze([
|
|
5
5
|
roleAgentOption("--model", "model", "model", false, BOTH_ADAPTERS),
|
|
6
6
|
roleAgentOption("--effort", "effort", "effort", false, BOTH_ADAPTERS),
|
|
7
|
+
roleAgentOption("--permission-strategy", "permission.strategy", "strategy", false, BOTH_ADAPTERS, { staticValues: ["default", "bypass", "configured"] }),
|
|
7
8
|
roleAgentOption("--sandbox", "permission.sandbox", "mode", false, CODEX_ONLY),
|
|
8
9
|
roleAgentOption("--approval", "permission.approval", "policy", false, CODEX_ONLY),
|
|
9
10
|
roleAgentOption("--permission-mode", "permission.mode", "mode", false, CLAUDE_ONLY),
|