@zq-silk/yui 0.15.11 → 0.16.0
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 +11 -6
- package/ARCHITECTURE.zh-CN.md +8 -4
- package/README.md +13 -5
- package/dist/agentRun/agentRun.js +3 -0
- package/dist/artifacts/artifactCommitLock.js +16 -55
- package/dist/artifacts/taskArtifactRepository.js +3 -3
- package/dist/cli/agentConfigurationPicker.js +1 -1
- package/dist/cli/commandCatalog.js +92 -48
- package/dist/cli/completion.js +18 -18
- package/dist/cli/completionWizard.js +1 -1
- package/dist/cli/dynamicCompletion.js +1 -1
- package/dist/cli/interactionPolicy.js +11 -3
- package/dist/cli/invocationAuthority.js +64 -0
- package/dist/cli/managedDiagnostics.js +2 -2
- package/dist/cli/parseRepeatable.js +35 -0
- package/dist/cli/updatePorts.js +26 -5
- package/dist/cli.js +1303 -1235
- package/dist/commands/agentCommands.js +4 -4
- package/dist/commands/capabilityCommands.js +1 -1
- package/dist/commands/configCommands.js +6 -57
- package/dist/commands/configOverview.js +2 -2
- package/dist/commands/durableJobCommands.js +12 -6
- package/dist/commands/executionAuditCommands.js +10 -0
- package/dist/commands/globalRoleCommands.js +78 -29
- package/dist/commands/grantCommands.js +0 -3
- package/dist/commands/jobCommands.js +1 -4
- package/dist/commands/operatorCommands.js +3 -3
- package/dist/commands/projectCommands.js +45 -25
- package/dist/commands/resourcesCommands.js +10 -40
- package/dist/commands/roleConfiguration.js +2 -6
- package/dist/commands/taskActivationCommands.js +4 -8
- package/dist/commands/taskAgentCapabilities.js +9 -0
- package/dist/commands/taskCommandSupport.js +155 -0
- package/dist/commands/taskCommandTypes.js +1 -0
- package/dist/commands/taskCommands.js +355 -732
- package/dist/commands/taskCompletionGate.js +1 -1
- package/dist/commands/taskExecutionCommands.js +1 -1
- package/dist/commands/taskFactCommands.js +325 -0
- package/dist/commands/taskInputCommands.js +12 -42
- package/dist/commands/taskIntegrationCommands.js +20 -58
- package/dist/commands/taskNextActionCommand.js +7 -6
- package/dist/commands/taskPublicationAdoptCommand.js +127 -0
- package/dist/commands/taskPublicationCommands.js +12 -3
- package/dist/commands/taskPublicationVerifyCommand.js +24 -40
- package/dist/commands/taskRemoteDeliveryCommand.js +5 -86
- package/dist/commands/taskUpstreamCommands.js +19 -8
- package/dist/commands/workflowCommands.js +6 -1
- package/dist/completion/completionInstaller.js +26 -26
- package/dist/completion/completionState.js +26 -26
- package/dist/completion/fileCompletionManager.js +6 -11
- package/dist/config/configCatalog.js +0 -2
- package/dist/config/timeZone.js +14 -0
- package/dist/config/yuiConfig.js +0 -29
- package/dist/context/runContextPack.js +5 -3
- package/dist/context/taskCatalog.js +185 -0
- package/dist/context/taskContext.js +152 -151
- package/dist/context/wakeRunReferences.js +11 -0
- package/dist/controller/agentCapabilities.js +58 -0
- package/dist/controller/agentRuntimeObserver.js +6 -11
- package/dist/controller/clientRuntime.js +22 -14
- package/dist/controller/controller.js +20 -24
- package/dist/controller/fileSchedulerStoreAdapter.js +191 -225
- package/dist/controller/globalInputDelivery.js +13 -0
- package/dist/controller/jobClient.js +4 -4
- package/dist/controller/jobControl.js +60 -25
- package/dist/controller/jobSupervisor.js +4 -4
- package/dist/controller/providerRetryAdmission.js +100 -0
- package/dist/controller/providerRetryDelivery.js +218 -0
- package/dist/controller/runtime.js +85 -43
- package/dist/controller/runtimeEventProcessor.js +0 -5
- package/dist/controller/sessionOwnerReconciliation.js +5 -0
- package/dist/controller/taskAgentError.js +35 -0
- package/dist/coordination/workMailboxQueue.js +2 -24
- package/dist/core/controllerClient.js +2 -2
- package/dist/core/fileLockOwner.js +74 -0
- package/dist/decision/decision.js +17 -0
- package/dist/doctor/doctor.js +18 -9
- package/dist/event/taskEvent.js +12 -0
- package/dist/execution/workItemExecutionProjection.js +2 -2
- package/dist/executor/agentCapabilityConfig.js +43 -0
- package/dist/executor/agentConfigurationCatalog.js +49 -11
- package/dist/executor/agentExecutor.js +5 -8
- package/dist/executor/fileRoleLaunchPlanner.js +11 -53
- package/dist/executor/taskAgentCapabilities.js +64 -0
- package/dist/integration/deliveryObligation.js +1 -69
- package/dist/integration/gitIntegrationService.js +79 -90
- package/dist/integration/integrationAttempt.js +3 -14
- package/dist/integration/integrationSourceApplication.js +4 -12
- package/dist/integration/manifestTags.js +2 -2
- package/dist/job/durableJob.js +4 -25
- package/dist/job/jobAssignmentScope.js +22 -0
- package/dist/job/jobOperation.js +16 -0
- package/dist/job/jobRunner.js +2 -1
- package/dist/job/stepDirectory.js +15 -0
- package/dist/kernel/builtinCapabilities.js +15 -11
- package/dist/kernel/kernelPorts.js +1 -17
- package/dist/lifecycle/exactRunTerminalization.js +5 -10
- package/dist/message/globalProviderRetry.js +15 -0
- package/dist/message/inputControlResolution.js +3 -4
- package/dist/message/message.js +17 -20
- package/dist/message/messageContinuation.js +1 -1
- package/dist/milestone/milestone.js +11 -0
- package/dist/observability/executionAudit.js +19 -0
- package/dist/observability/orchestrationMetrics.js +24 -1
- package/dist/observability/runtimeIdentity.js +1 -17
- package/dist/output/agentConfigurationPresentation.js +2 -0
- package/dist/output/timePresentation.js +1 -14
- package/dist/plugins/pluginService.js +12 -4
- package/dist/release/releaseWorkflowPorts.js +45 -96
- package/dist/release/runtimeRelease.js +9 -15
- package/dist/repository/gitWorkspace.js +371 -105
- package/dist/repository/projectMaintenanceLock.js +98 -82
- package/dist/repository/taskBaseFreshness.js +1 -1
- package/dist/repository/taskWorkspaceCoordinator.js +82 -144
- package/dist/repository/taskWorkspacePreparer.js +113 -47
- package/dist/repository/workspaceCleanupInspection.js +187 -0
- package/dist/resources/autoResourceGc.js +4 -77
- package/dist/resources/liveReferences.js +7 -54
- package/dist/resources/resourceDiscovery.js +5 -118
- package/dist/resources/resourceGc.js +233 -181
- package/dist/resources/resourceRegistrar.js +5 -4
- package/dist/resources/resourceRegistry.js +3 -37
- package/dist/resources/resourceRegistryStore.js +13 -36
- package/dist/resources/sqliteResourceRegistry.js +43 -26
- package/dist/review/deltaRecheck.js +1 -1
- package/dist/review/reviewAcceptance.js +1 -1
- package/dist/review/reviewDecision.js +1 -1
- package/dist/review/reviewRound.js +8 -7
- package/dist/review/taskFinalReviewContractResolution.js +1 -1
- package/dist/runtime/acpProtocol.js +4 -51
- package/dist/runtime/acpSession.js +10 -75
- package/dist/runtime/acpSessionConfiguration.js +1 -8
- package/dist/runtime/agentEndpoint.js +3 -2
- package/dist/runtime/agentError.js +5 -3
- package/dist/runtime/agentFailureContext.js +43 -0
- package/dist/runtime/agentHost.js +42 -25
- package/dist/runtime/builtinAgentErrorMappers.js +91 -0
- package/dist/runtime/codexAppServerRuntime.js +34 -3
- package/dist/runtime/codexInteractiveHost.js +2 -2
- package/dist/runtime/index.js +0 -1
- package/dist/runtime/managedCaller.js +21 -1
- package/dist/runtime/providerControl.js +5 -1
- package/dist/runtime/providerErrors.js +38 -0
- package/dist/runtime/providerRetry.js +198 -0
- package/dist/runtime/providerRuntimeIdentity.js +28 -2
- package/dist/runtime/runtimeObservation.js +0 -5
- package/dist/runtime/runtimeSessionCandidate.js +2 -3
- package/dist/runtime/sessionOwnerIdentity.js +1 -1
- package/dist/runtime/sessionTokenMetrics.js +15 -5
- package/dist/runtime/structuredProviderHost.js +10 -43
- package/dist/runtime/taskUsageMetrics.js +275 -0
- package/dist/runtime/tmuxAdapters.js +6 -8
- package/dist/scheduler/activeRoleRunDelivery.js +19 -7
- package/dist/scheduler/leaderWakeupProcessor.js +24 -6
- package/dist/scheduler/operatorEvent.js +12 -20
- package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
- package/dist/scheduler/ports.js +5 -8
- package/dist/scheduler/roleRunLiveness.js +4 -4
- package/dist/scheduler/roleRunStall.js +16 -23
- package/dist/scheduler/taskExecutionProjection.js +49 -36
- package/dist/scheduler/taskObservabilityProjection.js +6 -45
- package/dist/scheduler/taskWake.js +5 -10
- package/dist/scheduler/wakeReason.js +2 -0
- package/dist/scheduler/wakeupQueue.js +2 -4
- package/dist/setup/setupCommand.js +1 -1
- package/dist/storage/contextRecords.js +106 -0
- package/dist/storage/currentTaskStore.js +1 -1
- package/dist/storage/homeLayout.js +13 -17
- package/dist/storage/migrations/agentFailureContext.js +22 -0
- package/dist/storage/migrations/currentInputContract.js +86 -0
- package/dist/storage/migrations/currentRuntimeContract.js +228 -0
- package/dist/storage/migrations/historicalVerificationPlan.js +35 -0
- package/dist/storage/migrations/integrationContinuation.js +5 -4
- package/dist/storage/migrations/narrowAgentFailureContext.js +65 -0
- package/dist/storage/migrations/notificationOnlyWakes.js +74 -0
- package/dist/storage/migrations/verificationPlanV1.js +162 -0
- package/dist/storage/migrations/verificationPolicy.js +74 -0
- package/dist/storage/migrations/workItemHistory.js +46 -0
- package/dist/storage/persistenceWorker.js +12 -4
- package/dist/storage/recordValidation.js +87 -0
- package/dist/storage/sqliteSchema.js +173 -1
- package/dist/storage/sqliteStore.js +172 -161
- package/dist/storage/storageSchema.js +2 -14
- package/dist/storage/storageVersions.js +1 -1
- package/dist/storage/storeRpc.js +16 -7
- package/dist/storage/taskCatalog.js +123 -0
- package/dist/storage/taskStore.js +5 -7
- package/dist/storage/upgrade/upgradeOrchestrator.js +25 -37
- package/dist/task/archiveDiagnostics.js +1 -0
- package/dist/task/archivePreflight.js +124 -0
- package/dist/task/completionReadiness.js +5 -24
- package/dist/task/draftPlan.js +0 -53
- package/dist/task/nextAction.js +7 -13
- package/dist/task/publicationAdoption.js +56 -0
- package/dist/task/publicationReference.js +10 -0
- package/dist/task/remoteDelivery.js +31 -16
- package/dist/task/remoteDeliveryService.js +89 -0
- package/dist/task/taskActivation.js +2 -25
- package/dist/task/taskActivationService.js +0 -2
- package/dist/task/taskRecordReference.js +0 -1
- package/dist/task/taskSubmission.js +3 -14
- package/dist/telemetry/sqliteTelemetryBatch.js +29 -0
- package/dist/telemetry/sqliteTelemetryStore.js +49 -49
- package/dist/telemetry/telemetryWiring.js +4 -3
- package/dist/tmux/tmuxManager.js +29 -20
- package/dist/verification/gateArtifact.js +15 -24
- package/dist/verification/gateArtifactStore.js +14 -7
- package/dist/verification/verificationGateService.js +29 -88
- package/dist/verification/verificationPlan.js +27 -72
- package/dist/web/assets/client/app.js +92 -17
- package/dist/web/assets/client/components.js +55 -13
- package/dist/web/assets/client/i18n.js +72 -4
- package/dist/web/assets/client/taskSurface.js +6 -5
- package/dist/web/assets/client/view.js +35 -7
- package/dist/web/assets/shell.js +6 -0
- package/dist/web/assets/styles/layout.js +7 -0
- package/dist/web/webServer.js +12 -3
- package/dist/web/webSnapshot.js +14 -85
- package/dist/web/webTaskSurface.js +17 -46
- package/dist/workItem/workItem.js +1 -12
- package/dist/workspace/cleanupInspection.js +63 -0
- package/dist/workspace/workItemChangeSetManager.js +110 -50
- package/docs/agent-result-consumption.md +4 -0
- package/docs/agent-result-consumption.zh-CN.md +3 -0
- package/docs/agent-runtime-drivers.md +7 -0
- package/docs/agent-runtime-drivers.zh-CN.md +5 -0
- package/docs/architecture/README.md +2 -0
- package/docs/architecture/README.zh-CN.md +3 -1
- package/docs/architecture/capabilities-and-resources.md +42 -5
- package/docs/architecture/capabilities-and-resources.zh-CN.md +33 -3
- package/docs/managed-turn-and-session-runtime.md +121 -1
- package/docs/managed-turn-and-session-runtime.zh-CN.md +96 -2
- package/docs/observability/README.md +62 -0
- package/docs/observability/README.zh-CN.md +47 -0
- package/docs/plugin-sdk.md +4 -2
- package/docs/project-refresh.md +77 -0
- package/docs/project-refresh.zh-CN.md +59 -0
- package/docs/provider-retry.md +70 -0
- package/docs/provider-runtime.md +3 -1
- package/docs/provider-runtime.zh-CN.md +4 -2
- package/docs/release-workflow.md +190 -7
- package/docs/release-workflow.zh-CN.md +139 -5
- package/docs/roles-and-configuration.md +29 -0
- package/docs/roles-and-configuration.zh-CN.md +21 -0
- package/docs/sqlite-control-plane-design.md +16 -3
- package/docs/sqlite-control-plane-design.zh-CN.md +13 -2
- package/docs/task-dag-semantics.md +3 -3
- package/docs/task-dag-semantics.zh-CN.md +2 -2
- package/docs/task-delivery.md +223 -17
- package/docs/task-delivery.zh-CN.md +171 -14
- package/docs/task-discovery.md +101 -0
- package/docs/task-discovery.zh-CN.md +85 -0
- package/docs/testing/verification-levels.md +161 -9
- package/docs/testing/verification-levels.zh-CN.md +116 -9
- package/i18n/README.zh-CN.md +13 -7
- package/package.json +1 -1
- package/skills/yui-leader/SKILL.md +5 -0
- package/skills/yui-leader/references/execution.md +3 -2
- package/skills/yui-leader/references/integration.md +9 -5
- package/skills/yui-leader/references/planning.md +9 -3
- package/skills/yui-operator/SKILL.md +24 -8
- package/skills/yui-reviewer/SKILL.md +4 -0
- package/skills/yui-runtime/SKILL.md +17 -2
- package/skills/yui-runtime/references/publication.md +26 -4
- package/skills/yui-runtime/references/recovery.md +71 -0
- package/dist/agent/agentRegistry.js +0 -10
- package/dist/agentRun/runIdentity.js +0 -22
- package/dist/commands/deliveryGuardPreflight.js +0 -30
- package/dist/commands/taskIntegrationQueueCommands.js +0 -226
- package/dist/commands/taskOverviewCommand.js +0 -376
- package/dist/completion/completionWizard.js +0 -125
- package/dist/context/dispatchContext.js +0 -110
- package/dist/context/wakeNotification.js +0 -144
- package/dist/integration/integrationCheckEvidenceReuse.js +0 -53
- package/dist/integration/integrationQueueEntry.js +0 -191
- package/dist/integration/integrationQueueService.js +0 -810
- package/dist/release/fakeReleasePorts.js +0 -55
- package/dist/runtime/sessionOwnerRegistry.js +0 -137
- package/dist/task/deliveryGuard.js +0 -226
- /package/dist/{commands/taskActor.js → task/taskAuthority.js} +0 -0
package/dist/cli/completion.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ROOT_COMMAND, listPublicCommandPaths, orderedImmediateTokens, visibleChildren } from "./commandCatalog.js";
|
|
2
2
|
import { findInteractionPolicy } from "./interactionPolicy.js";
|
|
3
|
-
export function renderCompletion(shell
|
|
3
|
+
export function renderCompletion(shell) {
|
|
4
4
|
const entries = collectEntries(ROOT_COMMAND);
|
|
5
5
|
switch (shell) {
|
|
6
|
-
case "bash": return renderBash(entries
|
|
7
|
-
case "zsh": return renderZsh(entries
|
|
8
|
-
case "fish": return renderFish(entries
|
|
6
|
+
case "bash": return renderBash(entries);
|
|
7
|
+
case "zsh": return renderZsh(entries);
|
|
8
|
+
case "fish": return renderFish(entries);
|
|
9
9
|
default: throw new Error("Completion shell must be one of bash, zsh, fish.");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -30,8 +30,8 @@ function collectEntries(root) {
|
|
|
30
30
|
function manifest(prefix) {
|
|
31
31
|
return listPublicCommandPaths().map((path) => `${prefix} ${path}`).join("\n");
|
|
32
32
|
}
|
|
33
|
-
function renderBash(entries
|
|
34
|
-
const functionName =
|
|
33
|
+
function renderBash(entries) {
|
|
34
|
+
const functionName = "_yui";
|
|
35
35
|
return `${manifest("# yui command:")}
|
|
36
36
|
${functionName}() {
|
|
37
37
|
local current path previous dynamic_candidate dynamic=false
|
|
@@ -55,7 +55,7 @@ ${bashDynamicOptionCases(entries)}
|
|
|
55
55
|
if [[ "$dynamic" == true ]]; then
|
|
56
56
|
while IFS= read -r dynamic_candidate; do
|
|
57
57
|
[[ -n "$dynamic_candidate" ]] && dynamic_candidates+=("$dynamic_candidate")
|
|
58
|
-
done < <(command
|
|
58
|
+
done < <(command yui config completion candidates "$current" -- "\${COMP_WORDS[@]:1:COMP_CWORD-1}" 2>/dev/null)
|
|
59
59
|
candidates=("\${dynamic_candidates[@]}")
|
|
60
60
|
elif [[ "$current" == -* ]]; then
|
|
61
61
|
case "$path" in
|
|
@@ -70,11 +70,11 @@ ${entries.map((entry) => ` ${bashPattern(entry.path)}) candidates=(${[...en
|
|
|
70
70
|
fi
|
|
71
71
|
COMPREPLY=( $(compgen -W "\${candidates[*]}" -- "$current") )
|
|
72
72
|
}
|
|
73
|
-
complete -F ${functionName}
|
|
73
|
+
complete -F ${functionName} yui
|
|
74
74
|
`;
|
|
75
75
|
}
|
|
76
|
-
function renderZsh(entries
|
|
77
|
-
return `#compdef
|
|
76
|
+
function renderZsh(entries) {
|
|
77
|
+
return `#compdef yui
|
|
78
78
|
${manifest("# yui command:")}
|
|
79
79
|
local current command_path previous dynamic_output dynamic=false
|
|
80
80
|
local -a candidates
|
|
@@ -95,7 +95,7 @@ ${zshDynamicOptionCases(entries)}
|
|
|
95
95
|
esac
|
|
96
96
|
fi
|
|
97
97
|
if [[ "$dynamic" == true ]]; then
|
|
98
|
-
dynamic_output="$(command
|
|
98
|
+
dynamic_output="$(command yui config completion candidates "$current" -- "\${(@)words[2,CURRENT-1]}" 2>/dev/null)"
|
|
99
99
|
candidates=("\${(@f)dynamic_output}")
|
|
100
100
|
elif [[ "$current" == -* ]]; then
|
|
101
101
|
case "$command_path" in
|
|
@@ -111,8 +111,8 @@ fi
|
|
|
111
111
|
(( \${#candidates[@]} > 0 )) && compadd -- "$candidates[@]"
|
|
112
112
|
`;
|
|
113
113
|
}
|
|
114
|
-
function renderFish(entries
|
|
115
|
-
const prefix =
|
|
114
|
+
function renderFish(entries) {
|
|
115
|
+
const prefix = "__yui";
|
|
116
116
|
const lines = [
|
|
117
117
|
manifest("# yui command:"),
|
|
118
118
|
`function ${prefix}_at_path`,
|
|
@@ -151,17 +151,17 @@ function renderFish(entries, identity) {
|
|
|
151
151
|
"end",
|
|
152
152
|
`function ${prefix}_dynamic`,
|
|
153
153
|
" set -l words (commandline -opc)",
|
|
154
|
-
|
|
154
|
+
" yui config completion candidates (commandline -ct) -- $words[2..-1] 2>/dev/null",
|
|
155
155
|
"end"
|
|
156
156
|
];
|
|
157
157
|
for (const entry of entries) {
|
|
158
158
|
for (const argument of entry.dynamicArguments) {
|
|
159
159
|
const condition = `${prefix}_needs_dynamic argument ${argument} ${fishPath(entry.path)}`;
|
|
160
|
-
lines.push(`complete -c
|
|
160
|
+
lines.push(`complete -c yui -f -n ${fishQuote(condition)} -a '(${prefix}_dynamic)'`);
|
|
161
161
|
}
|
|
162
162
|
for (const option of entry.dynamicOptions) {
|
|
163
163
|
const condition = `${prefix}_needs_dynamic option ${option} ${fishPath(entry.path)}`;
|
|
164
|
-
lines.push(`complete -c
|
|
164
|
+
lines.push(`complete -c yui -f -n ${fishQuote(condition)} -a '(${prefix}_dynamic)'`);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
for (const entry of entries) {
|
|
@@ -169,13 +169,13 @@ function renderFish(entries, identity) {
|
|
|
169
169
|
const condition = entry.path.length === 0
|
|
170
170
|
? "__fish_use_subcommand"
|
|
171
171
|
: `${prefix}_at_path ${fishPath(entry.path)}${fishInitialDynamicExclusion(entry, prefix)}`;
|
|
172
|
-
lines.push(`complete -c
|
|
172
|
+
lines.push(`complete -c yui -f -n ${fishQuote(condition)} -a '${escapeSingle(entry.immediate.join(" "))}'`);
|
|
173
173
|
}
|
|
174
174
|
if (entry.options.length > 0) {
|
|
175
175
|
const path = fishPath(entry.path);
|
|
176
176
|
const exact = `${prefix}_at_path ${path}${fishInitialDynamicExclusion(entry, prefix)}`;
|
|
177
177
|
const condition = `begin; ${exact}; end; or ${prefix}_at_command_options ${path}`;
|
|
178
|
-
lines.push(`complete -c
|
|
178
|
+
lines.push(`complete -c yui -f -n ${fishQuote(condition)} -a '${escapeSingle(entry.options.join(" "))}'`);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
return `${lines.join("\n")}\n`;
|
|
@@ -41,7 +41,7 @@ export async function runCompletionWizard(port, io, options = {}) {
|
|
|
41
41
|
let activate = false;
|
|
42
42
|
let activationReady = automatic;
|
|
43
43
|
if (!automatic) {
|
|
44
|
-
const activationAnswer = normalize(await io.question(`${activationBlock(state.shell, installation
|
|
44
|
+
const activationAnswer = normalize(await io.question(`${activationBlock(state.shell, installation)}\n`
|
|
45
45
|
+ `Update ${installation.activationPath} with this managed Yui block? [Y/n]: `));
|
|
46
46
|
if (activationAnswer !== ""
|
|
47
47
|
&& activationAnswer !== "y"
|
|
@@ -2,7 +2,7 @@ import { findChild, ROOT_COMMAND, visibleChildren } from "./commandCatalog.js";
|
|
|
2
2
|
import { getSelectionCandidates } from "./interactionCandidates.js";
|
|
3
3
|
import { findInteractionPolicy } from "./interactionPolicy.js";
|
|
4
4
|
export async function resolveCompletionCandidates(input) {
|
|
5
|
-
const words = input.words[0] === "yui"
|
|
5
|
+
const words = input.words[0] === "yui"
|
|
6
6
|
? input.words.slice(1)
|
|
7
7
|
: [...input.words];
|
|
8
8
|
const { node, consumed } = resolveCommand(words);
|
|
@@ -223,12 +223,19 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
223
223
|
{
|
|
224
224
|
commandPath: ["task", "list"],
|
|
225
225
|
selectors: [],
|
|
226
|
-
trailingOptions: {
|
|
226
|
+
trailingOptions: {
|
|
227
|
+
"--all": "flag", "--status": "value", "--project": "value",
|
|
228
|
+
"--search": "value", "--attention": "value", "--limit": "value", "--cursor": "value"
|
|
229
|
+
}
|
|
227
230
|
},
|
|
228
231
|
{
|
|
229
232
|
...taskTarget("remote-delivery"),
|
|
230
233
|
trailingOptions: { "--json": "flag" }
|
|
231
234
|
},
|
|
235
|
+
{
|
|
236
|
+
...taskTarget("archive-preflight"),
|
|
237
|
+
trailingOptions: { "--integrated": "flag", "--abandon": "flag", "--force": "flag", "--json": "flag" }
|
|
238
|
+
},
|
|
232
239
|
{
|
|
233
240
|
...taskTarget("archive", 2, ["completed", "cancelled"]),
|
|
234
241
|
trailingOptions: { "--integrated": "flag", "--abandon": "flag", "--force": "flag" },
|
|
@@ -272,7 +279,7 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
272
279
|
provider: "messages",
|
|
273
280
|
actionTarget: true
|
|
274
281
|
}],
|
|
275
|
-
trailingOptions: { "--body-file": "value"
|
|
282
|
+
trailingOptions: { "--body-file": "value" }
|
|
276
283
|
},
|
|
277
284
|
{
|
|
278
285
|
commandPath: ["task", "message", "retire"],
|
|
@@ -550,7 +557,8 @@ export const INTERACTION_POLICIES = Object.freeze([
|
|
|
550
557
|
"--strategy": "value",
|
|
551
558
|
"--project": "value",
|
|
552
559
|
"--target": "value",
|
|
553
|
-
"--check": "value"
|
|
560
|
+
"--check": "value",
|
|
561
|
+
"--rerun-checks": "flag"
|
|
554
562
|
}
|
|
555
563
|
},
|
|
556
564
|
{
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { usageError } from "../errors/cliError.js";
|
|
2
|
+
import { requireManagedGlobalCaller } from "../runtime/managedCaller.js";
|
|
3
|
+
import { routeInvocation } from "./invocationRouter.js";
|
|
4
|
+
import { findInteractionPolicy } from "./interactionPolicy.js";
|
|
5
|
+
import { TASK_RECORD_ID_PREFIXES } from "../task/taskRecordReference.js";
|
|
6
|
+
import { taskDiagnosticTarget } from "./managedDiagnostics.js";
|
|
7
|
+
/** Configuration reads remain available; every Home configuration mutation
|
|
8
|
+
* has one owner, irrespective of which config subcommand parses its flags. */
|
|
9
|
+
export function assertConfigurationAuthority(args, store, env) {
|
|
10
|
+
const configurationWrite = args[0] === "config"
|
|
11
|
+
&& !["show", "describe"].includes(args[1] ?? "")
|
|
12
|
+
&& !["show", "list", "capabilities", "status", "candidates"].includes(args[2] ?? "");
|
|
13
|
+
const resourceWrite = args[0] === "resources" && args.some(arg => ["--apply", "--purge", "--restore"].includes(arg));
|
|
14
|
+
if (!configurationWrite && !resourceWrite)
|
|
15
|
+
return;
|
|
16
|
+
if (env.YUI_SESSION_SCOPE === "global" && env.YUI_ROLE === "operator") {
|
|
17
|
+
requireManagedGlobalCaller(store, env);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (env.YUI_SESSION_SCOPE !== undefined || env.YUI_ROLE !== undefined
|
|
21
|
+
|| env.YUI_AGENT_ID !== undefined || env.YUI_NATIVE_SESSION_ID !== undefined) {
|
|
22
|
+
throw usageError("Home configuration and resource mutations require the user or current Operator, not a Task Assignment.");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** The parsed command path identifies the first target argument, never a
|
|
26
|
+
* string found in a body/flag value. Record-local references retain their
|
|
27
|
+
* normal command-specific parser; an explicit foreign Task cannot pass it. */
|
|
28
|
+
export function assertTaskInvocationScope(args, env) {
|
|
29
|
+
if (env.YUI_SESSION_SCOPE !== "task")
|
|
30
|
+
return;
|
|
31
|
+
if (args[0] === "jobs" || (args[0] === "task" && ["create", "overlap"].includes(args[1] ?? ""))) {
|
|
32
|
+
throw usageError("This global operation is outside the caller's Task; use its scoped Context.");
|
|
33
|
+
}
|
|
34
|
+
if (args[0] !== "task" || args[1] === "list")
|
|
35
|
+
return;
|
|
36
|
+
const diagnostic = taskDiagnosticTarget(args);
|
|
37
|
+
if (diagnostic !== undefined) {
|
|
38
|
+
if (diagnostic !== env.YUI_TASK_ID)
|
|
39
|
+
throw usageError("Command target is outside the caller's Task.");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const invocation = routeInvocation([...args]);
|
|
43
|
+
if (invocation.kind !== "execute")
|
|
44
|
+
return;
|
|
45
|
+
let targetIndex = invocation.node.path.length - 1;
|
|
46
|
+
const optionSyntax = findInteractionPolicy(invocation.node)?.trailingOptions;
|
|
47
|
+
while (args[targetIndex]?.startsWith("--")) {
|
|
48
|
+
// Reuse known option arity, not any picker/confirmation authority. An
|
|
49
|
+
// unclassified prefix cannot turn a missing target into permission.
|
|
50
|
+
const kind = optionSyntax?.[args[targetIndex]];
|
|
51
|
+
if (kind === undefined)
|
|
52
|
+
throw usageError("Place this command's Task target before its options so its scope is explicit.");
|
|
53
|
+
targetIndex += kind === "flag" ? 1 : 2;
|
|
54
|
+
}
|
|
55
|
+
const target = args[targetIndex];
|
|
56
|
+
if (target === undefined)
|
|
57
|
+
return; // The domain parser still requires its target.
|
|
58
|
+
const taskId = target.split("/")[0];
|
|
59
|
+
const local = !target.includes("/") && Object.values(TASK_RECORD_ID_PREFIXES)
|
|
60
|
+
.some(prefix => target.startsWith(`${prefix}-`));
|
|
61
|
+
if (!local && taskId !== env.YUI_TASK_ID) {
|
|
62
|
+
throw usageError("Command target is outside the caller's Task.");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
export function taskDiagnosticTarget(args) {
|
|
4
4
|
if (args[0] !== "task")
|
|
5
5
|
return undefined;
|
|
6
|
-
if (["show", "context", "next-action"].includes(args[1] ?? "")) {
|
|
7
|
-
return args[1] === "context" && ["inspect", "delta"].includes(args[2] ?? "")
|
|
6
|
+
if (["show", "context", "next-action", "archive-preflight"].includes(args[1] ?? "")) {
|
|
7
|
+
return args[1] === "context" && ["read", "inspect", "delta"].includes(args[2] ?? "")
|
|
8
8
|
? args[3] : args[2];
|
|
9
9
|
}
|
|
10
10
|
if (args[1] === "role" && ["list", "status", "show"].includes(args[2] ?? ""))
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { usageError } from "../errors/cliError.js";
|
|
2
|
+
export function parseRepeatable(args, repeatable, singular, usage, flags = new Set()) {
|
|
3
|
+
const positionals = [];
|
|
4
|
+
const many = new Map();
|
|
5
|
+
const one = new Map();
|
|
6
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
7
|
+
const value = args[index];
|
|
8
|
+
if (!value.startsWith("--")) {
|
|
9
|
+
positionals.push(value);
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if (flags.has(value)) {
|
|
13
|
+
if (one.has(value))
|
|
14
|
+
throw usageError(`Option may only be specified once: ${value}.`, usage);
|
|
15
|
+
one.set(value, "true");
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (!repeatable.has(value) && !singular.has(value)) {
|
|
19
|
+
throw usageError(`Unsupported option: ${value}.`, usage);
|
|
20
|
+
}
|
|
21
|
+
if (singular.has(value) && one.has(value)) {
|
|
22
|
+
throw usageError(`Option may only be specified once: ${value}.`, usage);
|
|
23
|
+
}
|
|
24
|
+
const optionValue = args[index + 1];
|
|
25
|
+
if (optionValue === undefined || optionValue.startsWith("--")) {
|
|
26
|
+
throw usageError(`${value} is required.`, usage);
|
|
27
|
+
}
|
|
28
|
+
if (repeatable.has(value))
|
|
29
|
+
many.set(value, [...(many.get(value) ?? []), optionValue]);
|
|
30
|
+
else
|
|
31
|
+
one.set(value, optionValue);
|
|
32
|
+
index += 1;
|
|
33
|
+
}
|
|
34
|
+
return { positionals, many, one };
|
|
35
|
+
}
|
package/dist/cli/updatePorts.js
CHANGED
|
@@ -238,6 +238,7 @@ export function createUpdatePorts(environment, spawn = spawnSync, stagingRoot =
|
|
|
238
238
|
}
|
|
239
239
|
const UPDATE_CLI_PATH = fileURLToPath(new URL("../cli.js", import.meta.url));
|
|
240
240
|
const UPDATE_CLIENT_RUNTIME_PATH = fileURLToPath(new URL("../controller/clientRuntime.js", import.meta.url));
|
|
241
|
+
const UPDATE_INVENTORY_PATH = fileURLToPath(new URL("../controller/resourceInventoryLinux.js", import.meta.url));
|
|
241
242
|
const UPDATE_CONTROLLER_RECONCILIATION_PATH = fileURLToPath(new URL("../controller/updateReconciliation.js", import.meta.url));
|
|
242
243
|
/**
|
|
243
244
|
* Capture running state plus an authenticated exact process identity before
|
|
@@ -522,18 +523,38 @@ function restoreControllerIdentity(home, identity, environment, spawn) {
|
|
|
522
523
|
assertSpawnOk(result, "restore the previously running Controller identity");
|
|
523
524
|
}
|
|
524
525
|
function runControllerCommand(home, environment, spawn, method, cliBinary) {
|
|
525
|
-
|
|
526
|
-
|
|
526
|
+
let command = cliBinary ?? process.execPath;
|
|
527
|
+
let args = cliBinary === undefined
|
|
527
528
|
? [UPDATE_CLI_PATH, "--json", "controller", method]
|
|
528
529
|
: ["--json", "controller", method];
|
|
530
|
+
if (method === "status") {
|
|
531
|
+
// Lifecycle capture consumes the resource collector, not public status's
|
|
532
|
+
// current-schema health verdict. This is the same schema-independent seam
|
|
533
|
+
// used for update-owned stop/reconciliation, with no environment bypass.
|
|
534
|
+
const inventoryModule = cliBinary === undefined
|
|
535
|
+
? UPDATE_INVENTORY_PATH
|
|
536
|
+
: join(dirname(activatedControllerEntrypoint(cliBinary)), "resourceInventoryLinux.js");
|
|
537
|
+
const helper = [
|
|
538
|
+
"(async () => {",
|
|
539
|
+
" const { pathToFileURL } = await import('node:url');",
|
|
540
|
+
" const { scanControllerResourceInventory } = await import(pathToFileURL(process.argv[1]).href);",
|
|
541
|
+
" const data = await scanControllerResourceInventory({",
|
|
542
|
+
" currentHome: process.argv[2], scope: 'current', environment: process.env",
|
|
543
|
+
" });",
|
|
544
|
+
" process.stdout.write(JSON.stringify({ ok: true, data }));",
|
|
545
|
+
"})().catch(error => {",
|
|
546
|
+
" process.stderr.write(JSON.stringify({ ok: false, code: error.code ?? 'RUNTIME_ERROR', message: error.message }));",
|
|
547
|
+
" process.exitCode = 5;",
|
|
548
|
+
"});"
|
|
549
|
+
].join(" ");
|
|
550
|
+
command = process.execPath;
|
|
551
|
+
args = ["-e", helper, inventoryModule, home];
|
|
552
|
+
}
|
|
529
553
|
const result = spawn(command, args, {
|
|
530
554
|
cwd: process.cwd(),
|
|
531
555
|
env: {
|
|
532
556
|
...environment,
|
|
533
557
|
YUI_HOME: home,
|
|
534
|
-
// Lifecycle capture needs the schema-independent resource inventory,
|
|
535
|
-
// not the optional current-schema identity health verdict.
|
|
536
|
-
YUI_STATUS_IDENTITY: "0",
|
|
537
558
|
// This exact lifecycle child is part of the update process that owns
|
|
538
559
|
// the handover lock. Managed Sessions never receive this bypass.
|
|
539
560
|
YUI_UPDATE_HANDOVER_OWNER_PID: String(process.pid)
|