@caupulican/pi-adaptative 0.93.2 → 0.93.4
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/CHANGELOG.md +26 -0
- package/dist/bundled-resources/skills/worker-profile-writer/SKILL.md +6 -6
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session-contracts.d.ts +2 -2
- package/dist/core/agent-session-contracts.d.ts.map +1 -1
- package/dist/core/agent-session-contracts.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +16 -11
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/approval-gate.d.ts +1 -0
- package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
- package/dist/core/autonomy/approval-gate.js +4 -1
- package/dist/core/autonomy/approval-gate.js.map +1 -1
- package/dist/core/autonomy/composite-tool-gate.d.ts +13 -0
- package/dist/core/autonomy/composite-tool-gate.d.ts.map +1 -0
- package/dist/core/autonomy/composite-tool-gate.js +44 -0
- package/dist/core/autonomy/composite-tool-gate.js.map +1 -0
- package/dist/core/autonomy/envelope-enforcement.d.ts +2 -0
- package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.js +48 -7
- package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
- package/dist/core/autonomy/gates.d.ts.map +1 -1
- package/dist/core/autonomy/gates.js +48 -76
- package/dist/core/autonomy/gates.js.map +1 -1
- package/dist/core/autonomy/path-scope.d.ts.map +1 -1
- package/dist/core/autonomy/path-scope.js +7 -7
- package/dist/core/autonomy/path-scope.js.map +1 -1
- package/dist/core/autonomy/subagent-prompt.d.ts +1 -1
- package/dist/core/autonomy/subagent-prompt.js.map +1 -1
- package/dist/core/background-tool-task-controller.d.ts +2 -0
- package/dist/core/background-tool-task-controller.d.ts.map +1 -1
- package/dist/core/background-tool-task-controller.js +13 -5
- package/dist/core/background-tool-task-controller.js.map +1 -1
- package/dist/core/compaction-controller.d.ts +3 -0
- package/dist/core/compaction-controller.d.ts.map +1 -1
- package/dist/core/compaction-controller.js +132 -97
- package/dist/core/compaction-controller.js.map +1 -1
- package/dist/core/cost-guard.js +1 -1
- package/dist/core/cost-guard.js.map +1 -1
- package/dist/core/delegation/session-root-mailbox.d.ts.map +1 -1
- package/dist/core/delegation/session-root-mailbox.js +14 -1
- package/dist/core/delegation/session-root-mailbox.js.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.js +6 -9
- package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.js +7 -5
- package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
- package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -1
- package/dist/core/delegation/worker-authority-resolver.js +3 -2
- package/dist/core/delegation/worker-authority-resolver.js.map +1 -1
- package/dist/core/delegation/worker-delegation-request.d.ts +5 -2
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-request.js +1 -1
- package/dist/core/delegation/worker-delegation-request.js.map +1 -1
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
- package/dist/core/delegation/worker-execution-policy.js +10 -8
- package/dist/core/delegation/worker-execution-policy.js.map +1 -1
- package/dist/core/foreground-recovery-controller.d.ts +2 -0
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
- package/dist/core/foreground-recovery-controller.js +18 -9
- package/dist/core/foreground-recovery-controller.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +3 -5
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.js +6 -0
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
- package/dist/core/goals/goal-session-controller.js +1 -1
- package/dist/core/goals/goal-session-controller.js.map +1 -1
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +1 -0
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +2 -0
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +1 -1
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/model-router-controller.js +2 -2
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
- package/dist/core/orchestration/capability-gateway.js +32 -9
- package/dist/core/orchestration/capability-gateway.js.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.js +5 -5
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
- package/dist/core/orchestration/policy-compiler.d.ts.map +1 -1
- package/dist/core/orchestration/policy-compiler.js +7 -0
- package/dist/core/orchestration/policy-compiler.js.map +1 -1
- package/dist/core/orchestration/profile-registry.js +2 -2
- package/dist/core/orchestration/profile-registry.js.map +1 -1
- package/dist/core/orchestration/risk-budget.d.ts +0 -10
- package/dist/core/orchestration/risk-budget.d.ts.map +1 -1
- package/dist/core/orchestration/risk-budget.js +0 -14
- package/dist/core/orchestration/risk-budget.js.map +1 -1
- package/dist/core/pipelines/active-context.d.ts +16 -0
- package/dist/core/pipelines/active-context.d.ts.map +1 -0
- package/dist/core/pipelines/active-context.js +29 -0
- package/dist/core/pipelines/active-context.js.map +1 -0
- package/dist/core/pipelines/context.d.ts +1 -1
- package/dist/core/pipelines/context.d.ts.map +1 -1
- package/dist/core/pipelines/context.js +40 -31
- package/dist/core/pipelines/context.js.map +1 -1
- package/dist/core/pipelines/discover.d.ts +5 -1
- package/dist/core/pipelines/discover.d.ts.map +1 -1
- package/dist/core/pipelines/discover.js +91 -33
- package/dist/core/pipelines/discover.js.map +1 -1
- package/dist/core/pipelines/increment.d.ts +0 -2
- package/dist/core/pipelines/increment.d.ts.map +1 -1
- package/dist/core/pipelines/increment.js +35 -13
- package/dist/core/pipelines/increment.js.map +1 -1
- package/dist/core/pipelines/index.d.ts +4 -3
- package/dist/core/pipelines/index.d.ts.map +1 -1
- package/dist/core/pipelines/index.js +4 -3
- package/dist/core/pipelines/index.js.map +1 -1
- package/dist/core/pipelines/run-state.d.ts +8 -0
- package/dist/core/pipelines/run-state.d.ts.map +1 -1
- package/dist/core/pipelines/run-state.js +172 -38
- package/dist/core/pipelines/run-state.js.map +1 -1
- package/dist/core/pipelines/types.d.ts +2 -0
- package/dist/core/pipelines/types.d.ts.map +1 -1
- package/dist/core/pipelines/types.js +21 -4
- package/dist/core/pipelines/types.js.map +1 -1
- package/dist/core/provider-prompt-contracts.d.ts +1 -0
- package/dist/core/provider-prompt-contracts.d.ts.map +1 -1
- package/dist/core/provider-prompt-contracts.js +6 -5
- package/dist/core/provider-prompt-contracts.js.map +1 -1
- package/dist/core/reflection-controller.js +1 -1
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +2 -1
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +46 -10
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/settings-manager.d.ts +5 -6
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +8 -13
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +2 -4
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +35 -11
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +6 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/task-projection.d.ts +2 -0
- package/dist/core/tasks/task-projection.d.ts.map +1 -1
- package/dist/core/tasks/task-projection.js +2 -0
- package/dist/core/tasks/task-projection.js.map +1 -1
- package/dist/core/tasks/task-state.d.ts +10 -0
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js +43 -2
- package/dist/core/tasks/task-state.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts +13 -3
- package/dist/core/tool-capability-policy.d.ts.map +1 -1
- package/dist/core/tool-capability-policy.js +136 -28
- package/dist/core/tool-capability-policy.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +0 -16
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +21 -11
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +45 -7
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +5 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +17 -1
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
- package/dist/core/tools/orchestration-panel.js +1 -0
- package/dist/core/tools/orchestration-panel.js.map +1 -1
- package/dist/core/tools/persistent-process-coordinator.d.ts.map +1 -1
- package/dist/core/tools/persistent-process-coordinator.js +12 -7
- package/dist/core/tools/persistent-process-coordinator.js.map +1 -1
- package/dist/core/tools/pipeline.d.ts +1 -0
- package/dist/core/tools/pipeline.d.ts.map +1 -1
- package/dist/core/tools/pipeline.js +95 -44
- package/dist/core/tools/pipeline.js.map +1 -1
- package/dist/core/tools/profile-writer.d.ts +0 -9
- package/dist/core/tools/profile-writer.d.ts.map +1 -1
- package/dist/core/tools/profile-writer.js +0 -3
- package/dist/core/tools/profile-writer.js.map +1 -1
- package/dist/core/tools/secret-store.d.ts.map +1 -1
- package/dist/core/tools/secret-store.js +2 -1
- package/dist/core/tools/secret-store.js.map +1 -1
- package/dist/core/tools/shell-session.d.ts.map +1 -1
- package/dist/core/tools/shell-session.js +6 -1
- package/dist/core/tools/shell-session.js.map +1 -1
- package/dist/core/tools/task-steps.d.ts +10 -0
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +70 -29
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
- package/dist/core/tools/windows-shell-engine.js +6 -1
- package/dist/core/tools/windows-shell-engine.js.map +1 -1
- package/dist/core/util/bounded-file.d.ts +8 -0
- package/dist/core/util/bounded-file.d.ts.map +1 -1
- package/dist/core/util/bounded-file.js +81 -16
- package/dist/core/util/bounded-file.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +7 -16
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +2 -11
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
- package/dist/modes/interactive/local-model-commands.js +1 -10
- package/dist/modes/interactive/local-model-commands.js.map +1 -1
- package/dist/modes/interactive/thinking-level-descriptions.d.ts +4 -0
- package/dist/modes/interactive/thinking-level-descriptions.d.ts.map +1 -0
- package/dist/modes/interactive/thinking-level-descriptions.js +12 -0
- package/dist/modes/interactive/thinking-level-descriptions.js.map +1 -0
- package/docs/resources.md +1 -1
- package/docs/settings.md +7 -5
- package/docs/worker-profiles.md +3 -3
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { createWorkRunId } from "../../utils/work-directory.js";
|
|
3
|
-
import { abandonPipelineRun, assembleStageContext, createPipelineRunRoot, discoverPipelineDefinitions,
|
|
3
|
+
import { abandonPipelineRun, assembleStageContext, createPipelineRunRoot, discoverPipelineDefinitions, findPipelineDefinition, formatPipelineContext, incrementPipelineRun, instantiatePipelineRun, isPipelineRunActive, loadPipelineRunById, resolveCurrentProjectPipelineRun, resolvePipelineDefinitionForRun, scanPipelineRun, withPipelineLifecycleLock, } from "../pipelines/index.js";
|
|
4
4
|
import { emptyOrchestrationCall, renderOrchestrationToolResult, } from "./orchestration-panel.js";
|
|
5
5
|
const pipelineSchema = Type.Object({
|
|
6
6
|
action: Type.Union([
|
|
@@ -21,14 +21,19 @@ function errorResult(action, error, run) {
|
|
|
21
21
|
isError: true,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function resolveRun(deps, runId) {
|
|
24
|
+
function resolveRun(deps, cwd, runId) {
|
|
25
25
|
if (runId?.trim())
|
|
26
|
-
return loadPipelineRunById(
|
|
27
|
-
return
|
|
26
|
+
return loadPipelineRunById(cwd, runId.trim());
|
|
27
|
+
return resolveCurrentProjectPipelineRun(cwd, deps.getPipelineRun());
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
function saveSessionSnapshot(deps, run) {
|
|
30
|
+
try {
|
|
31
|
+
deps.savePipelineRun(run);
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return `Durable pipeline state was saved, but the session snapshot failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
function formatDefinitionList(definitions, active) {
|
|
34
39
|
if (definitions.length === 0) {
|
|
@@ -39,7 +44,7 @@ function formatDefinitionList(definitions, active) {
|
|
|
39
44
|
return `- ${definition.name} (${definition.form}, ${definition.stages.length} stages: ${stages})`;
|
|
40
45
|
});
|
|
41
46
|
if (active) {
|
|
42
|
-
lines.unshift(
|
|
47
|
+
lines.unshift(`${isPipelineRunActive(active) ? "Active" : "Latest"} run ${active.runId}: ${active.pipelineName} @ ${active.currentStageId} (${active.status}).`);
|
|
43
48
|
}
|
|
44
49
|
return `Pipelines:\n${lines.join("\n")}`;
|
|
45
50
|
}
|
|
@@ -73,6 +78,7 @@ function pipelinePanel(details) {
|
|
|
73
78
|
status: run.status === "completed" ? "success" : run.status === "abandoned" || details.error ? "warning" : "running",
|
|
74
79
|
summary: [`${run.pipelineName}`, run.currentStageId, run.status],
|
|
75
80
|
emptyText: details.error,
|
|
81
|
+
notices: details.warning ? [{ status: "warning", text: details.warning }] : undefined,
|
|
76
82
|
};
|
|
77
83
|
}
|
|
78
84
|
export function createPipelineToolDefinition(deps) {
|
|
@@ -85,9 +91,11 @@ export function createPipelineToolDefinition(deps) {
|
|
|
85
91
|
promptGuidelines: [
|
|
86
92
|
"Use for repeating sequential workflows with stage folders. Status is output/ files, not chat memory.",
|
|
87
93
|
"increment completes the current stage then starts the next. Write outputs first. No Review-now latch.",
|
|
94
|
+
"Pipeline task_steps require active pipelineRunId+pipelineStageId; clearPipelineLink removes both; unlinked steps do not gate increment.",
|
|
88
95
|
"Use task_steps advance for checklists, goal increment for requirements, delegate for concurrent work.",
|
|
89
96
|
],
|
|
90
97
|
parameters: pipelineSchema,
|
|
98
|
+
executionMode: "sequential",
|
|
91
99
|
renderShell: "self",
|
|
92
100
|
renderCall() {
|
|
93
101
|
return emptyOrchestrationCall();
|
|
@@ -102,11 +110,12 @@ export function createPipelineToolDefinition(deps) {
|
|
|
102
110
|
},
|
|
103
111
|
async execute(_toolCallId, input) {
|
|
104
112
|
const timestamp = now();
|
|
105
|
-
const
|
|
113
|
+
const cwd = deps.cwd();
|
|
114
|
+
const discoverOpts = { agentPipelinesDir: deps.agentPipelinesDir(), cwd };
|
|
106
115
|
try {
|
|
107
116
|
if (input.action === "list") {
|
|
108
117
|
const definitions = discoverPipelineDefinitions(discoverOpts);
|
|
109
|
-
const active = resolveRun(deps, input.runId);
|
|
118
|
+
const active = resolveRun(deps, cwd, input.runId);
|
|
110
119
|
return {
|
|
111
120
|
content: [{ type: "text", text: formatDefinitionList(definitions, active) }],
|
|
112
121
|
details: { action: "list", applied: false, run: active },
|
|
@@ -119,24 +128,34 @@ export function createPipelineToolDefinition(deps) {
|
|
|
119
128
|
if (!definition) {
|
|
120
129
|
return errorResult("start", `No pipeline definition named '${input.name.trim()}'.`);
|
|
121
130
|
}
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
const admission = withPipelineLifecycleLock(cwd, () => {
|
|
132
|
+
const existing = resolveRun(deps, cwd, undefined);
|
|
133
|
+
if (existing && isPipelineRunActive(existing)) {
|
|
134
|
+
return { applied: false, run: existing };
|
|
135
|
+
}
|
|
136
|
+
const runId = deps.createRunId?.() ?? createWorkRunId();
|
|
137
|
+
return {
|
|
138
|
+
applied: true,
|
|
139
|
+
run: instantiatePipelineRun({
|
|
140
|
+
definition,
|
|
141
|
+
runId,
|
|
142
|
+
runRoot: createPipelineRunRoot(cwd, runId),
|
|
143
|
+
goalId: input.goalId?.trim() || deps.getGoalState?.()?.goalId,
|
|
144
|
+
now: timestamp,
|
|
145
|
+
}),
|
|
146
|
+
};
|
|
133
147
|
});
|
|
134
|
-
|
|
148
|
+
if (!admission.applied) {
|
|
149
|
+
return errorResult("start", `An active run '${admission.run.runId}' already exists. Increment or abandon it first.`, admission.run);
|
|
150
|
+
}
|
|
151
|
+
const run = admission.run;
|
|
152
|
+
const snapshotWarning = saveSessionSnapshot(deps, run);
|
|
135
153
|
const stage = definition.stages[0];
|
|
136
154
|
const assembled = assembleStageContext(definition, run, stage);
|
|
137
155
|
const text = [
|
|
138
156
|
`pipeline start recorded. Run ${run.runId} at ${stage.id}.`,
|
|
139
157
|
formatPipelineContext(definition, run, assembled),
|
|
158
|
+
...(snapshotWarning ? [`Warning: ${snapshotWarning}`] : []),
|
|
140
159
|
].join("\n");
|
|
141
160
|
return {
|
|
142
161
|
content: [{ type: "text", text }],
|
|
@@ -144,18 +163,19 @@ export function createPipelineToolDefinition(deps) {
|
|
|
144
163
|
action: "start",
|
|
145
164
|
applied: true,
|
|
146
165
|
run,
|
|
166
|
+
warning: snapshotWarning,
|
|
147
167
|
definitionName: definition.name,
|
|
148
168
|
},
|
|
149
169
|
};
|
|
150
170
|
}
|
|
151
|
-
const current = resolveRun(deps, input.runId);
|
|
152
|
-
if (!current)
|
|
153
|
-
return errorResult(input.action, "No active pipeline run. Use start first.");
|
|
154
|
-
const definition = resolveDefinition(deps, current);
|
|
155
|
-
if (!definition) {
|
|
156
|
-
return errorResult(input.action, `Pipeline definition '${current.pipelineName}' is missing.`, current);
|
|
157
|
-
}
|
|
158
171
|
if (input.action === "status") {
|
|
172
|
+
const current = resolveRun(deps, cwd, input.runId);
|
|
173
|
+
if (!current)
|
|
174
|
+
return errorResult("status", "No active pipeline run. Use start first.");
|
|
175
|
+
const definition = resolvePipelineDefinitionForRun(discoverOpts, current);
|
|
176
|
+
if (!definition) {
|
|
177
|
+
return errorResult("status", `Pipeline definition '${current.pipelineName}' is missing.`, current);
|
|
178
|
+
}
|
|
159
179
|
const assembled = assembleStageContext(definition, current);
|
|
160
180
|
return {
|
|
161
181
|
content: [
|
|
@@ -167,35 +187,66 @@ export function createPipelineToolDefinition(deps) {
|
|
|
167
187
|
details: { action: "status", applied: false, run: current },
|
|
168
188
|
};
|
|
169
189
|
}
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
190
|
+
const mutation = withPipelineLifecycleLock(cwd, () => {
|
|
191
|
+
const current = resolveRun(deps, cwd, input.runId);
|
|
192
|
+
if (!current) {
|
|
193
|
+
return { kind: "error", error: "No active pipeline run. Use start first.", run: undefined };
|
|
194
|
+
}
|
|
195
|
+
if (input.action === "abandon") {
|
|
196
|
+
return { kind: "abandon", run: abandonPipelineRun(current, timestamp) };
|
|
197
|
+
}
|
|
198
|
+
const definition = resolvePipelineDefinitionForRun(discoverOpts, current);
|
|
199
|
+
if (!definition) {
|
|
200
|
+
return {
|
|
201
|
+
kind: "error",
|
|
202
|
+
error: `Pipeline definition '${current.pipelineName}' is missing.`,
|
|
203
|
+
run: current,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const advanced = incrementPipelineRun(definition, current, timestamp, {
|
|
207
|
+
openTaskSteps: deps.getOpenTaskSteps?.(),
|
|
208
|
+
backgroundToolTasks: deps.getBackgroundToolTasks?.(),
|
|
209
|
+
});
|
|
210
|
+
return { kind: "increment", definition, ...advanced };
|
|
211
|
+
});
|
|
212
|
+
if (mutation.kind === "error") {
|
|
213
|
+
return errorResult(input.action, mutation.error, mutation.run);
|
|
214
|
+
}
|
|
215
|
+
const snapshotWarning = saveSessionSnapshot(deps, mutation.run);
|
|
216
|
+
if (mutation.kind === "abandon") {
|
|
173
217
|
return {
|
|
174
218
|
content: [
|
|
175
|
-
{
|
|
219
|
+
{
|
|
220
|
+
type: "text",
|
|
221
|
+
text: `pipeline abandon recorded. Run ${mutation.run.runId} is abandoned.${snapshotWarning ? `\nWarning: ${snapshotWarning}` : ""}`,
|
|
222
|
+
},
|
|
176
223
|
],
|
|
177
|
-
details: {
|
|
224
|
+
details: {
|
|
225
|
+
action: "abandon",
|
|
226
|
+
applied: true,
|
|
227
|
+
run: mutation.run,
|
|
228
|
+
warning: snapshotWarning,
|
|
229
|
+
},
|
|
178
230
|
};
|
|
179
231
|
}
|
|
180
|
-
const
|
|
181
|
-
goal: deps.getGoalState?.(),
|
|
182
|
-
openTaskSteps: deps.getOpenTaskSteps?.(),
|
|
183
|
-
backgroundToolTasks: deps.getBackgroundToolTasks?.(),
|
|
184
|
-
});
|
|
185
|
-
deps.savePipelineRun(advanced.run);
|
|
186
|
-
const assembled = assembleStageContext(definition, advanced.run);
|
|
232
|
+
const assembled = assembleStageContext(mutation.definition, mutation.run);
|
|
187
233
|
return {
|
|
188
234
|
content: [
|
|
189
235
|
{
|
|
190
236
|
type: "text",
|
|
191
|
-
text: `pipeline increment recorded. ${
|
|
237
|
+
text: `pipeline increment recorded. ${mutation.result.detail}\n${formatPipelineContext(mutation.definition, mutation.run, assembled)}${snapshotWarning ? `\nWarning: ${snapshotWarning}` : ""}`,
|
|
192
238
|
},
|
|
193
239
|
],
|
|
194
|
-
details: {
|
|
240
|
+
details: {
|
|
241
|
+
action: "increment",
|
|
242
|
+
applied: true,
|
|
243
|
+
run: mutation.run,
|
|
244
|
+
warning: snapshotWarning,
|
|
245
|
+
},
|
|
195
246
|
};
|
|
196
247
|
}
|
|
197
248
|
catch (error) {
|
|
198
|
-
return errorResult(input.action, error instanceof Error ? error.message : String(error)
|
|
249
|
+
return errorResult(input.action, error instanceof Error ? error.message : String(error));
|
|
199
250
|
}
|
|
200
251
|
},
|
|
201
252
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/core/tools/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAKhE,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EAGnB,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,sBAAsB,EAEtB,6BAA6B,GAC7B,MAAM,0BAA0B,CAAC;AAElC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CACjC;IACC,MAAM,EAAE,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EAAE,IAAI,CAAC,sBAAsB,EAAE,EAAE;iBACpD,CAAC,CAAC;gBACH,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACnC,MAAM,SAAS,GAAG,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACjE,OAAO;oBACN,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,gCAAgC,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,qBAAqB,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE;yBAC7H;qBACD;oBACD,OAAO,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAgC;iBAChG,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,WAAW,CACjB,KAAK,CAAC,MAAM,EACZ,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { createWorkRunId } from \"../../utils/work-directory.ts\";\nimport type { BackgroundToolTaskRef } from \"../background-tool-task-controller.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport type { GoalState } from \"../goals/goal-state.ts\";\nimport type { OpenTaskStepRef } from \"../goals/goal-tool-core.ts\";\nimport {\n\tabandonPipelineRun,\n\tassembleStageContext,\n\tcreatePipelineRunRoot,\n\tdiscoverPipelineDefinitions,\n\tfindActivePipelineRun,\n\tfindPipelineDefinition,\n\tformatPipelineContext,\n\tincrementPipelineRun,\n\tinstantiatePipelineRun,\n\tisPipelineRunActive,\n\tloadPipelineDefinition,\n\tloadPipelineRunById,\n\ttype PipelineDefinition,\n\ttype PipelineRun,\n\tscanPipelineRun,\n} from \"../pipelines/index.ts\";\nimport {\n\temptyOrchestrationCall,\n\ttype OrchestrationPanelModel,\n\trenderOrchestrationToolResult,\n} from \"./orchestration-panel.ts\";\n\nconst pipelineSchema = Type.Object(\n\t{\n\t\taction: Type.Union(\n\t\t\t[\n\t\t\t\tType.Literal(\"list\"),\n\t\t\t\tType.Literal(\"start\"),\n\t\t\t\tType.Literal(\"status\"),\n\t\t\t\tType.Literal(\"increment\"),\n\t\t\t\tType.Literal(\"abandon\"),\n\t\t\t],\n\t\t\t{ description: \"list definitions; start a run; status from output/; increment current; abandon.\" },\n\t\t),\n\t\tname: Type.Optional(Type.String({ minLength: 1, maxLength: 64, description: \"Definition name for start.\" })),\n\t\trunId: Type.Optional(\n\t\t\tType.String({ minLength: 1, maxLength: 128, description: \"Run id. Defaults to the active run.\" }),\n\t\t),\n\t\tgoalId: Type.Optional(\n\t\t\tType.String({ minLength: 1, maxLength: 128, description: \"Optional goal to join on start.\" }),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type PipelineToolInput = Static<typeof pipelineSchema>;\nexport type PipelineToolAction = PipelineToolInput[\"action\"];\n\nexport interface PipelineToolDetails {\n\taction: PipelineToolAction;\n\tapplied: boolean;\n\terror?: string;\n\trun?: PipelineRun;\n\tdefinitionName?: string;\n}\n\nexport interface PipelineToolDependencies {\n\tcwd: () => string;\n\tagentPipelinesDir: () => string;\n\tgetPipelineRun: () => PipelineRun | undefined;\n\tsavePipelineRun: (run: PipelineRun) => void;\n\tgetGoalState?: () => GoalState | undefined;\n\tgetOpenTaskSteps?: () => readonly OpenTaskStepRef[];\n\tgetBackgroundToolTasks?: () => readonly BackgroundToolTaskRef[];\n\tnow?: () => string;\n\tcreateRunId?: () => string;\n}\n\nfunction errorResult(action: PipelineToolAction, error: string, run?: PipelineRun) {\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text: `pipeline ${action} failed: ${error}` }],\n\t\tdetails: { action, applied: false, error, run } satisfies PipelineToolDetails,\n\t\tisError: true as const,\n\t};\n}\n\nfunction resolveRun(deps: PipelineToolDependencies, runId: string | undefined): PipelineRun | undefined {\n\tif (runId?.trim()) return loadPipelineRunById(deps.cwd(), runId.trim());\n\treturn deps.getPipelineRun() ?? findActivePipelineRun(deps.cwd());\n}\n\nfunction resolveDefinition(deps: PipelineToolDependencies, run: PipelineRun): PipelineDefinition | undefined {\n\treturn (\n\t\tloadPipelineDefinition(run.definitionPath) ??\n\t\tfindPipelineDefinition({ agentPipelinesDir: deps.agentPipelinesDir(), cwd: deps.cwd() }, run.pipelineName)\n\t);\n}\n\nfunction formatDefinitionList(definitions: readonly PipelineDefinition[], active?: PipelineRun): string {\n\tif (definitions.length === 0) {\n\t\treturn \"No pipeline definitions. Put a numbered-stage workspace in .pi/pipelines/ or ~/.pi/agent/pipelines/.\";\n\t}\n\tconst lines = definitions.map((definition) => {\n\t\tconst stages = definition.stages.map((stage) => stage.id).join(\", \");\n\t\treturn `- ${definition.name} (${definition.form}, ${definition.stages.length} stages: ${stages})`;\n\t});\n\tif (active) {\n\t\tlines.unshift(\n\t\t\t`Active run ${active.runId}: ${active.pipelineName} @ ${active.currentStageId} (${active.status}).`,\n\t\t);\n\t}\n\treturn `Pipelines:\\n${lines.join(\"\\n\")}`;\n}\n\nfunction formatStatus(definition: PipelineDefinition, run: PipelineRun): string {\n\tconst scans = scanPipelineRun(definition, run);\n\tconst lines = [\n\t\t`Pipeline '${definition.name}' run ${run.runId} ${run.status}. Current stage: ${run.currentStageId}.`,\n\t\t...scans.map((scan) => {\n\t\t\tconst mark = scan.status === \"complete\" ? \"x\" : \" \";\n\t\t\tconst files = scan.outputFiles.length > 0 ? ` (${scan.outputFiles.join(\", \")})` : \"\";\n\t\t\treturn `- [${mark}] ${scan.stageId}${files}`;\n\t\t}),\n\t];\n\tif (run.goalId) lines.push(`Joined goal: ${run.goalId}.`);\n\treturn lines.join(\"\\n\");\n}\n\nfunction pipelinePanel(details: PipelineToolDetails | undefined): OrchestrationPanelModel {\n\tconst run = details?.run;\n\tif (!run) {\n\t\treturn {\n\t\t\tlabel: \"pipeline\",\n\t\t\taction: details?.action,\n\t\t\tstatus: details?.error ? \"error\" : \"idle\",\n\t\t\temptyText: details?.error ?? \"No pipeline run.\",\n\t\t};\n\t}\n\treturn {\n\t\tlabel: \"pipeline\",\n\t\taction: details.action,\n\t\tstatus:\n\t\t\trun.status === \"completed\" ? \"success\" : run.status === \"abandoned\" || details.error ? \"warning\" : \"running\",\n\t\tsummary: [`${run.pipelineName}`, run.currentStageId, run.status],\n\t\temptyText: details.error,\n\t};\n}\n\nexport function createPipelineToolDefinition(deps: PipelineToolDependencies): ToolDefinition {\n\tconst now = deps.now ?? (() => new Date().toISOString());\n\treturn {\n\t\tname: \"pipeline\",\n\t\tlabel: \"Pipeline\",\n\t\tdescription:\n\t\t\t\"Run an ICM folder pipeline: numbered stages, load only the current contract, increment when output/ has files.\",\n\t\tpromptSnippet: \"Walk a folder pipeline one stage at a time.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use for repeating sequential workflows with stage folders. Status is output/ files, not chat memory.\",\n\t\t\t\"increment completes the current stage then starts the next. Write outputs first. No Review-now latch.\",\n\t\t\t\"Use task_steps advance for checklists, goal increment for requirements, delegate for concurrent work.\",\n\t\t],\n\t\tparameters: pipelineSchema,\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(result, { expanded, isPartial }, theme) {\n\t\t\tconst details = result.details as PipelineToolDetails | undefined;\n\t\t\treturn renderOrchestrationToolResult(theme, pipelinePanel(details), {\n\t\t\t\tisPartial,\n\t\t\t\tcollapse: !expanded && details?.applied === true,\n\t\t\t\texpanded: true,\n\t\t\t});\n\t\t},\n\t\tasync execute(_toolCallId, input: PipelineToolInput) {\n\t\t\tconst timestamp = now();\n\t\t\tconst discoverOpts = { agentPipelinesDir: deps.agentPipelinesDir(), cwd: deps.cwd() };\n\t\t\ttry {\n\t\t\t\tif (input.action === \"list\") {\n\t\t\t\t\tconst definitions = discoverPipelineDefinitions(discoverOpts);\n\t\t\t\t\tconst active = resolveRun(deps, input.runId);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: formatDefinitionList(definitions, active) }],\n\t\t\t\t\t\tdetails: { action: \"list\", applied: false, run: active } satisfies PipelineToolDetails,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (input.action === \"start\") {\n\t\t\t\t\tif (!input.name?.trim()) return errorResult(\"start\", \"start requires name.\");\n\t\t\t\t\tconst definition = findPipelineDefinition(discoverOpts, input.name);\n\t\t\t\t\tif (!definition) {\n\t\t\t\t\t\treturn errorResult(\"start\", `No pipeline definition named '${input.name.trim()}'.`);\n\t\t\t\t\t}\n\t\t\t\t\tconst existing = deps.getPipelineRun();\n\t\t\t\t\tif (existing && isPipelineRunActive(existing)) {\n\t\t\t\t\t\treturn errorResult(\n\t\t\t\t\t\t\t\"start\",\n\t\t\t\t\t\t\t`An active run '${existing.runId}' already exists. Increment or abandon it first.`,\n\t\t\t\t\t\t\texisting,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst runId = deps.createRunId?.() ?? createWorkRunId();\n\t\t\t\t\tconst run = instantiatePipelineRun({\n\t\t\t\t\t\tdefinition,\n\t\t\t\t\t\trunId,\n\t\t\t\t\t\trunRoot: createPipelineRunRoot(deps.cwd(), runId),\n\t\t\t\t\t\tgoalId: input.goalId?.trim() || deps.getGoalState?.()?.goalId,\n\t\t\t\t\t\tnow: timestamp,\n\t\t\t\t\t});\n\t\t\t\t\tdeps.savePipelineRun(run);\n\t\t\t\t\tconst stage = definition.stages[0]!;\n\t\t\t\t\tconst assembled = assembleStageContext(definition, run, stage);\n\t\t\t\t\tconst text = [\n\t\t\t\t\t\t`pipeline start recorded. Run ${run.runId} at ${stage.id}.`,\n\t\t\t\t\t\tformatPipelineContext(definition, run, assembled),\n\t\t\t\t\t].join(\"\\n\");\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\taction: \"start\",\n\t\t\t\t\t\t\tapplied: true,\n\t\t\t\t\t\t\trun,\n\t\t\t\t\t\t\tdefinitionName: definition.name,\n\t\t\t\t\t\t} satisfies PipelineToolDetails,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst current = resolveRun(deps, input.runId);\n\t\t\t\tif (!current) return errorResult(input.action, \"No active pipeline run. Use start first.\");\n\t\t\t\tconst definition = resolveDefinition(deps, current);\n\t\t\t\tif (!definition) {\n\t\t\t\t\treturn errorResult(input.action, `Pipeline definition '${current.pipelineName}' is missing.`, current);\n\t\t\t\t}\n\n\t\t\t\tif (input.action === \"status\") {\n\t\t\t\t\tconst assembled = assembleStageContext(definition, current);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\t\ttext: `${formatStatus(definition, current)}\\n${formatPipelineContext(definition, current, assembled)}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdetails: { action: \"status\", applied: false, run: current } satisfies PipelineToolDetails,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (input.action === \"abandon\") {\n\t\t\t\t\tconst run = abandonPipelineRun(current, timestamp);\n\t\t\t\t\tdeps.savePipelineRun(run);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{ type: \"text\" as const, text: `pipeline abandon recorded. Run ${run.runId} is abandoned.` },\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdetails: { action: \"abandon\", applied: true, run } satisfies PipelineToolDetails,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst advanced = incrementPipelineRun(definition, current, timestamp, {\n\t\t\t\t\tgoal: deps.getGoalState?.(),\n\t\t\t\t\topenTaskSteps: deps.getOpenTaskSteps?.(),\n\t\t\t\t\tbackgroundToolTasks: deps.getBackgroundToolTasks?.(),\n\t\t\t\t});\n\t\t\t\tdeps.savePipelineRun(advanced.run);\n\t\t\t\tconst assembled = assembleStageContext(definition, advanced.run);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `pipeline increment recorded. ${advanced.result.detail}\\n${formatPipelineContext(definition, advanced.run, assembled)}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { action: \"increment\", applied: true, run: advanced.run } satisfies PipelineToolDetails,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\treturn errorResult(\n\t\t\t\t\tinput.action,\n\t\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t\t\tdeps.getPipelineRun(),\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/core/tools/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAKhE,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EAGnB,gCAAgC,EAChC,+BAA+B,EAC/B,eAAe,EACf,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,sBAAsB,EAEtB,6BAA6B,GAC7B,MAAM,0BAA0B,CAAC;AAElC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,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AAG;wBACjB,OAAO,EAAE,eAAe;qBACM;iBAC/B,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1F,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { createWorkRunId } from \"../../utils/work-directory.ts\";\nimport type { BackgroundToolTaskRef } from \"../background-tool-task-controller.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport type { GoalState } from \"../goals/goal-state.ts\";\nimport type { OpenTaskStepRef } from \"../goals/goal-tool-core.ts\";\nimport {\n\tabandonPipelineRun,\n\tassembleStageContext,\n\tcreatePipelineRunRoot,\n\tdiscoverPipelineDefinitions,\n\tfindPipelineDefinition,\n\tformatPipelineContext,\n\tincrementPipelineRun,\n\tinstantiatePipelineRun,\n\tisPipelineRunActive,\n\tloadPipelineRunById,\n\ttype PipelineDefinition,\n\ttype PipelineRun,\n\tresolveCurrentProjectPipelineRun,\n\tresolvePipelineDefinitionForRun,\n\tscanPipelineRun,\n\twithPipelineLifecycleLock,\n} from \"../pipelines/index.ts\";\nimport {\n\temptyOrchestrationCall,\n\ttype OrchestrationPanelModel,\n\trenderOrchestrationToolResult,\n} from \"./orchestration-panel.ts\";\n\nconst pipelineSchema = Type.Object(\n\t{\n\t\taction: Type.Union(\n\t\t\t[\n\t\t\t\tType.Literal(\"list\"),\n\t\t\t\tType.Literal(\"start\"),\n\t\t\t\tType.Literal(\"status\"),\n\t\t\t\tType.Literal(\"increment\"),\n\t\t\t\tType.Literal(\"abandon\"),\n\t\t\t],\n\t\t\t{ description: \"list definitions; start a run; status from output/; increment current; abandon.\" },\n\t\t),\n\t\tname: Type.Optional(Type.String({ minLength: 1, maxLength: 64, description: \"Definition name for start.\" })),\n\t\trunId: Type.Optional(\n\t\t\tType.String({ minLength: 1, maxLength: 128, description: \"Run id. Defaults to the active run.\" }),\n\t\t),\n\t\tgoalId: Type.Optional(\n\t\t\tType.String({ minLength: 1, maxLength: 128, description: \"Optional goal to join on start.\" }),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type PipelineToolInput = Static<typeof pipelineSchema>;\nexport type PipelineToolAction = PipelineToolInput[\"action\"];\n\nexport interface PipelineToolDetails {\n\taction: PipelineToolAction;\n\tapplied: boolean;\n\terror?: string;\n\twarning?: string;\n\trun?: PipelineRun;\n\tdefinitionName?: string;\n}\n\nexport interface PipelineToolDependencies {\n\tcwd: () => string;\n\tagentPipelinesDir: () => string;\n\tgetPipelineRun: () => PipelineRun | undefined;\n\tsavePipelineRun: (run: PipelineRun) => void;\n\tgetGoalState?: () => GoalState | undefined;\n\tgetOpenTaskSteps?: () => readonly OpenTaskStepRef[];\n\tgetBackgroundToolTasks?: () => readonly BackgroundToolTaskRef[];\n\tnow?: () => string;\n\tcreateRunId?: () => string;\n}\n\nfunction errorResult(action: PipelineToolAction, error: string, run?: PipelineRun) {\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text: `pipeline ${action} failed: ${error}` }],\n\t\tdetails: { action, applied: false, error, run } satisfies PipelineToolDetails,\n\t\tisError: true as const,\n\t};\n}\n\nfunction resolveRun(deps: PipelineToolDependencies, cwd: string, runId: string | undefined): PipelineRun | undefined {\n\tif (runId?.trim()) return loadPipelineRunById(cwd, runId.trim());\n\treturn resolveCurrentProjectPipelineRun(cwd, deps.getPipelineRun());\n}\n\nfunction saveSessionSnapshot(deps: PipelineToolDependencies, run: PipelineRun): string | undefined {\n\ttry {\n\t\tdeps.savePipelineRun(run);\n\t\treturn undefined;\n\t} catch (error) {\n\t\treturn `Durable pipeline state was saved, but the session snapshot failed: ${error instanceof Error ? error.message : String(error)}`;\n\t}\n}\n\nfunction formatDefinitionList(definitions: readonly PipelineDefinition[], active?: PipelineRun): string {\n\tif (definitions.length === 0) {\n\t\treturn \"No pipeline definitions. Put a numbered-stage workspace in .pi/pipelines/ or ~/.pi/agent/pipelines/.\";\n\t}\n\tconst lines = definitions.map((definition) => {\n\t\tconst stages = definition.stages.map((stage) => stage.id).join(\", \");\n\t\treturn `- ${definition.name} (${definition.form}, ${definition.stages.length} stages: ${stages})`;\n\t});\n\tif (active) {\n\t\tlines.unshift(\n\t\t\t`${isPipelineRunActive(active) ? \"Active\" : \"Latest\"} run ${active.runId}: ${active.pipelineName} @ ${active.currentStageId} (${active.status}).`,\n\t\t);\n\t}\n\treturn `Pipelines:\\n${lines.join(\"\\n\")}`;\n}\n\nfunction formatStatus(definition: PipelineDefinition, run: PipelineRun): string {\n\tconst scans = scanPipelineRun(definition, run);\n\tconst lines = [\n\t\t`Pipeline '${definition.name}' run ${run.runId} ${run.status}. Current stage: ${run.currentStageId}.`,\n\t\t...scans.map((scan) => {\n\t\t\tconst mark = scan.status === \"complete\" ? \"x\" : \" \";\n\t\t\tconst files = scan.outputFiles.length > 0 ? ` (${scan.outputFiles.join(\", \")})` : \"\";\n\t\t\treturn `- [${mark}] ${scan.stageId}${files}`;\n\t\t}),\n\t];\n\tif (run.goalId) lines.push(`Joined goal: ${run.goalId}.`);\n\treturn lines.join(\"\\n\");\n}\n\nfunction pipelinePanel(details: PipelineToolDetails | undefined): OrchestrationPanelModel {\n\tconst run = details?.run;\n\tif (!run) {\n\t\treturn {\n\t\t\tlabel: \"pipeline\",\n\t\t\taction: details?.action,\n\t\t\tstatus: details?.error ? \"error\" : \"idle\",\n\t\t\temptyText: details?.error ?? \"No pipeline run.\",\n\t\t};\n\t}\n\treturn {\n\t\tlabel: \"pipeline\",\n\t\taction: details.action,\n\t\tstatus:\n\t\t\trun.status === \"completed\" ? \"success\" : run.status === \"abandoned\" || details.error ? \"warning\" : \"running\",\n\t\tsummary: [`${run.pipelineName}`, run.currentStageId, run.status],\n\t\temptyText: details.error,\n\t\tnotices: details.warning ? [{ status: \"warning\", text: details.warning }] : undefined,\n\t};\n}\n\nexport function createPipelineToolDefinition(deps: PipelineToolDependencies): ToolDefinition {\n\tconst now = deps.now ?? (() => new Date().toISOString());\n\treturn {\n\t\tname: \"pipeline\",\n\t\tlabel: \"Pipeline\",\n\t\tdescription:\n\t\t\t\"Run an ICM folder pipeline: numbered stages, load only the current contract, increment when output/ has files.\",\n\t\tpromptSnippet: \"Walk a folder pipeline one stage at a time.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use for repeating sequential workflows with stage folders. Status is output/ files, not chat memory.\",\n\t\t\t\"increment completes the current stage then starts the next. Write outputs first. No Review-now latch.\",\n\t\t\t\"Pipeline task_steps require active pipelineRunId+pipelineStageId; clearPipelineLink removes both; unlinked steps do not gate increment.\",\n\t\t\t\"Use task_steps advance for checklists, goal increment for requirements, delegate for concurrent work.\",\n\t\t],\n\t\tparameters: pipelineSchema,\n\t\texecutionMode: \"sequential\",\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(result, { expanded, isPartial }, theme) {\n\t\t\tconst details = result.details as PipelineToolDetails | undefined;\n\t\t\treturn renderOrchestrationToolResult(theme, pipelinePanel(details), {\n\t\t\t\tisPartial,\n\t\t\t\tcollapse: !expanded && details?.applied === true,\n\t\t\t\texpanded: true,\n\t\t\t});\n\t\t},\n\t\tasync execute(_toolCallId, input: PipelineToolInput) {\n\t\t\tconst timestamp = now();\n\t\t\tconst cwd = deps.cwd();\n\t\t\tconst discoverOpts = { agentPipelinesDir: deps.agentPipelinesDir(), cwd };\n\t\t\ttry {\n\t\t\t\tif (input.action === \"list\") {\n\t\t\t\t\tconst definitions = discoverPipelineDefinitions(discoverOpts);\n\t\t\t\t\tconst active = resolveRun(deps, cwd, input.runId);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: formatDefinitionList(definitions, active) }],\n\t\t\t\t\t\tdetails: { action: \"list\", applied: false, run: active } satisfies PipelineToolDetails,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (input.action === \"start\") {\n\t\t\t\t\tif (!input.name?.trim()) return errorResult(\"start\", \"start requires name.\");\n\t\t\t\t\tconst definition = findPipelineDefinition(discoverOpts, input.name);\n\t\t\t\t\tif (!definition) {\n\t\t\t\t\t\treturn errorResult(\"start\", `No pipeline definition named '${input.name.trim()}'.`);\n\t\t\t\t\t}\n\t\t\t\t\tconst admission = withPipelineLifecycleLock(cwd, () => {\n\t\t\t\t\t\tconst existing = resolveRun(deps, cwd, undefined);\n\t\t\t\t\t\tif (existing && isPipelineRunActive(existing)) {\n\t\t\t\t\t\t\treturn { applied: false as const, run: existing };\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst runId = deps.createRunId?.() ?? createWorkRunId();\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tapplied: true as const,\n\t\t\t\t\t\t\trun: instantiatePipelineRun({\n\t\t\t\t\t\t\t\tdefinition,\n\t\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\t\trunRoot: createPipelineRunRoot(cwd, runId),\n\t\t\t\t\t\t\t\tgoalId: input.goalId?.trim() || deps.getGoalState?.()?.goalId,\n\t\t\t\t\t\t\t\tnow: timestamp,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t\tif (!admission.applied) {\n\t\t\t\t\t\treturn errorResult(\n\t\t\t\t\t\t\t\"start\",\n\t\t\t\t\t\t\t`An active run '${admission.run.runId}' already exists. Increment or abandon it first.`,\n\t\t\t\t\t\t\tadmission.run,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst run = admission.run;\n\t\t\t\t\tconst snapshotWarning = saveSessionSnapshot(deps, run);\n\t\t\t\t\tconst stage = definition.stages[0]!;\n\t\t\t\t\tconst assembled = assembleStageContext(definition, run, stage);\n\t\t\t\t\tconst text = [\n\t\t\t\t\t\t`pipeline start recorded. Run ${run.runId} at ${stage.id}.`,\n\t\t\t\t\t\tformatPipelineContext(definition, run, assembled),\n\t\t\t\t\t\t...(snapshotWarning ? [`Warning: ${snapshotWarning}`] : []),\n\t\t\t\t\t].join(\"\\n\");\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\taction: \"start\",\n\t\t\t\t\t\t\tapplied: true,\n\t\t\t\t\t\t\trun,\n\t\t\t\t\t\t\twarning: snapshotWarning,\n\t\t\t\t\t\t\tdefinitionName: definition.name,\n\t\t\t\t\t\t} satisfies PipelineToolDetails,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (input.action === \"status\") {\n\t\t\t\t\tconst current = resolveRun(deps, cwd, input.runId);\n\t\t\t\t\tif (!current) return errorResult(\"status\", \"No active pipeline run. Use start first.\");\n\t\t\t\t\tconst definition = resolvePipelineDefinitionForRun(discoverOpts, current);\n\t\t\t\t\tif (!definition) {\n\t\t\t\t\t\treturn errorResult(\"status\", `Pipeline definition '${current.pipelineName}' is missing.`, current);\n\t\t\t\t\t}\n\t\t\t\t\tconst assembled = assembleStageContext(definition, current);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\t\ttext: `${formatStatus(definition, current)}\\n${formatPipelineContext(definition, current, assembled)}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdetails: { action: \"status\", applied: false, run: current } satisfies PipelineToolDetails,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst mutation = withPipelineLifecycleLock(cwd, () => {\n\t\t\t\t\tconst current = resolveRun(deps, cwd, input.runId);\n\t\t\t\t\tif (!current) {\n\t\t\t\t\t\treturn { kind: \"error\" as const, error: \"No active pipeline run. Use start first.\", run: undefined };\n\t\t\t\t\t}\n\t\t\t\t\tif (input.action === \"abandon\") {\n\t\t\t\t\t\treturn { kind: \"abandon\" as const, run: abandonPipelineRun(current, timestamp) };\n\t\t\t\t\t}\n\t\t\t\t\tconst definition = resolvePipelineDefinitionForRun(discoverOpts, current);\n\t\t\t\t\tif (!definition) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: \"error\" as const,\n\t\t\t\t\t\t\terror: `Pipeline definition '${current.pipelineName}' is missing.`,\n\t\t\t\t\t\t\trun: current,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tconst advanced = incrementPipelineRun(definition, current, timestamp, {\n\t\t\t\t\t\topenTaskSteps: deps.getOpenTaskSteps?.(),\n\t\t\t\t\t\tbackgroundToolTasks: deps.getBackgroundToolTasks?.(),\n\t\t\t\t\t});\n\t\t\t\t\treturn { kind: \"increment\" as const, definition, ...advanced };\n\t\t\t\t});\n\t\t\t\tif (mutation.kind === \"error\") {\n\t\t\t\t\treturn errorResult(input.action, mutation.error, mutation.run);\n\t\t\t\t}\n\t\t\t\tconst snapshotWarning = saveSessionSnapshot(deps, mutation.run);\n\t\t\t\tif (mutation.kind === \"abandon\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\t\ttext: `pipeline abandon recorded. Run ${mutation.run.runId} is abandoned.${snapshotWarning ? `\\nWarning: ${snapshotWarning}` : \"\"}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\taction: \"abandon\",\n\t\t\t\t\t\t\tapplied: true,\n\t\t\t\t\t\t\trun: mutation.run,\n\t\t\t\t\t\t\twarning: snapshotWarning,\n\t\t\t\t\t\t} satisfies PipelineToolDetails,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst assembled = assembleStageContext(mutation.definition, mutation.run);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `pipeline increment recorded. ${mutation.result.detail}\\n${formatPipelineContext(mutation.definition, mutation.run, assembled)}${snapshotWarning ? `\\nWarning: ${snapshotWarning}` : \"\"}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\taction: \"increment\",\n\t\t\t\t\t\tapplied: true,\n\t\t\t\t\t\trun: mutation.run,\n\t\t\t\t\t\twarning: snapshotWarning,\n\t\t\t\t\t} satisfies PipelineToolDetails,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\treturn errorResult(input.action, error instanceof Error ? error.message : String(error));\n\t\t\t}\n\t\t},\n\t};\n}\n"]}
|
|
@@ -9,7 +9,6 @@ export interface DelegateProfileInput {
|
|
|
9
9
|
model?: TaskProfileCreateInput["model"];
|
|
10
10
|
toolNames?: readonly string[];
|
|
11
11
|
resourceProfileNames?: readonly string[];
|
|
12
|
-
budget?: TaskProfileCreateInput["budget"];
|
|
13
12
|
}
|
|
14
13
|
export interface DelegateProfileToolDetails extends TaskProfileCreateResult {
|
|
15
14
|
started: boolean;
|
|
@@ -27,14 +26,6 @@ export declare function createDelegateProfileParameterSchemas(): {
|
|
|
27
26
|
}>>;
|
|
28
27
|
toolNames: Type.TOptional<Type.TArray<Type.TString>>;
|
|
29
28
|
resourceProfileNames: Type.TOptional<Type.TArray<Type.TString>>;
|
|
30
|
-
budget: Type.TOptional<Type.TObject<{
|
|
31
|
-
maxTokens: Type.TOptional<Type.TNumber>;
|
|
32
|
-
maxWallClockMs: Type.TOptional<Type.TNumber>;
|
|
33
|
-
maxCostUsd: Type.TOptional<Type.TNumber>;
|
|
34
|
-
maxAttempts: Type.TOptional<Type.TNumber>;
|
|
35
|
-
maxToolCalls: Type.TOptional<Type.TNumber>;
|
|
36
|
-
requireApprovalAboveCostUsd: Type.TOptional<Type.TNumber>;
|
|
37
|
-
}>>;
|
|
38
29
|
};
|
|
39
30
|
export declare function delegateProfilePanelModel(details: DelegateProfileToolDetails): OrchestrationPanelModel;
|
|
40
31
|
export declare function formatTaskProfileInspection(inspection: TaskProfileInspection): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-writer.d.ts","sourceRoot":"","sources":["../../../src/core/tools/profile-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"profile-writer.d.ts","sourceRoot":"","sources":["../../../src/core/tools/profile-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAQ/B,OAAO,KAAK,EACX,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,eAAO,MAAM,wBAAwB,YAAI,iBAAiB,EAAE,gBAAgB,CAAU,CAAC;AAEvF,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,MAAM,WAAW,oBAAoB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IAC1E,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACnC;AAED,wBAAgB,qCAAqC;IAEnD,IAAI;IACJ,aAAa;IACb,KAAK;;;;;IAaL,SAAS;IAKT,oBAAoB;EAMrB;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,uBAAuB,CA2BtG;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,qBAAqB,GAAG,MAAM,CAGrF;AAED,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,qBAAqB,EAC7B,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,qBAAqB,GAC3B;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,EAAE,0BAA0B,CAAA;CAAE,CA6CzF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { MAX_ORCHESTRATION_COLLECTION_LENGTH, MAX_ORCHESTRATION_IDENTIFIER_LENGTH, MAX_ORCHESTRATION_MODEL_ID_LENGTH, MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH, ORCHESTRATION_THINKING_LEVELS, } from "../orchestration/contracts.js";
|
|
3
|
-
import { createRiskBudgetSchema } from "../orchestration/risk-budget.js";
|
|
4
3
|
export const DELEGATE_PROFILE_ACTIONS = ["profile_inspect", "profile_create"];
|
|
5
4
|
export function createDelegateProfileParameterSchemas() {
|
|
6
5
|
return {
|
|
@@ -20,7 +19,6 @@ export function createDelegateProfileParameterSchemas() {
|
|
|
20
19
|
resourceProfileNames: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH }), {
|
|
21
20
|
maxItems: MAX_ORCHESTRATION_COLLECTION_LENGTH,
|
|
22
21
|
})),
|
|
23
|
-
budget: Type.Optional(createRiskBudgetSchema()),
|
|
24
22
|
};
|
|
25
23
|
}
|
|
26
24
|
export function delegateProfilePanelModel(details) {
|
|
@@ -86,7 +84,6 @@ export function executeDelegateProfileAction(action, input, writer) {
|
|
|
86
84
|
...(input.model !== undefined ? { model: input.model } : {}),
|
|
87
85
|
...(input.toolNames !== undefined ? { toolNames: input.toolNames } : {}),
|
|
88
86
|
...(input.resourceProfileNames !== undefined ? { resourceProfileNames: input.resourceProfileNames } : {}),
|
|
89
|
-
...(input.budget !== undefined ? { budget: input.budget } : {}),
|
|
90
87
|
};
|
|
91
88
|
const result = writer.createTaskProfile(request);
|
|
92
89
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-writer.js","sourceRoot":"","sources":["../../../src/core/tools/profile-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,6BAA6B,GAC7B,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"profile-writer.js","sourceRoot":"","sources":["../../../src/core/tools/profile-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,6BAA6B,GAC7B,MAAM,+BAA+B,CAAC;AASvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAU,CAAC;AAmBvF,MAAM,UAAU,qCAAqC;IACpD,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QACpE,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,mCAAmC,EAAE,CAAC,CAAC;QAC3G,KAAK,E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,SAAS,MAAM,CAAC,aAAa,GAAG;oBAC5F,CAAC,CAAC,iDAAiD,MAAM,CAAC,MAAM,GAAG;aACpE;SACD;QACD,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;KACxE,CAAC;AACH,CAAC","sourcesContent":["import { Type } from \"typebox\";\nimport {\n\tMAX_ORCHESTRATION_COLLECTION_LENGTH,\n\tMAX_ORCHESTRATION_IDENTIFIER_LENGTH,\n\tMAX_ORCHESTRATION_MODEL_ID_LENGTH,\n\tMAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH,\n\tORCHESTRATION_THINKING_LEVELS,\n} from \"../orchestration/contracts.ts\";\nimport type {\n\tTaskProfileCreateInput,\n\tTaskProfileCreateResult,\n\tTaskProfileInspection,\n\tTaskProfileWriterPort,\n} from \"../orchestration/task-profile-writer.ts\";\nimport type { OrchestrationPanelModel } from \"./orchestration-panel.ts\";\n\nexport const DELEGATE_PROFILE_ACTIONS = [\"profile_inspect\", \"profile_create\"] as const;\n\nexport type DelegateProfileAction = (typeof DELEGATE_PROFILE_ACTIONS)[number];\n\nexport interface DelegateProfileInput {\n\ttask?: string;\n\tbaseProfileId?: string;\n\tmodel?: TaskProfileCreateInput[\"model\"];\n\ttoolNames?: readonly string[];\n\tresourceProfileNames?: readonly string[];\n}\n\nexport interface DelegateProfileToolDetails extends TaskProfileCreateResult {\n\tstarted: boolean;\n\taction: DelegateProfileAction;\n\tkind: \"profile\";\n\tinspection?: TaskProfileInspection;\n}\n\nexport function createDelegateProfileParameterSchemas() {\n\treturn {\n\t\ttask: Type.Optional(Type.String({ minLength: 1, maxLength: 3_500 })),\n\t\tbaseProfileId: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH })),\n\t\tmodel: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tprovider: Type.String({\n\t\t\t\t\t\tminLength: 1,\n\t\t\t\t\t\tmaxLength: MAX_ORCHESTRATION_MODEL_PROVIDER_LENGTH,\n\t\t\t\t\t}),\n\t\t\t\t\tmodelId: Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_MODEL_ID_LENGTH }),\n\t\t\t\t\tthinkingLevel: Type.Union(ORCHESTRATION_THINKING_LEVELS.map((level) => Type.Literal(level))),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: false },\n\t\t\t),\n\t\t),\n\t\ttoolNames: Type.Optional(\n\t\t\tType.Array(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH }), {\n\t\t\t\tmaxItems: MAX_ORCHESTRATION_COLLECTION_LENGTH,\n\t\t\t}),\n\t\t),\n\t\tresourceProfileNames: Type.Optional(\n\t\t\tType.Array(Type.String({ minLength: 1, maxLength: MAX_ORCHESTRATION_IDENTIFIER_LENGTH }), {\n\t\t\t\tmaxItems: MAX_ORCHESTRATION_COLLECTION_LENGTH,\n\t\t\t}),\n\t\t),\n\t};\n}\n\nexport function delegateProfilePanelModel(details: DelegateProfileToolDetails): OrchestrationPanelModel {\n\tif (details.action === \"profile_inspect\") {\n\t\treturn {\n\t\t\tlabel: \"worker profiles\",\n\t\t\taction: \"inspected\",\n\t\t\tstatus: \"success\",\n\t\t\tsummary: [\n\t\t\t\t`${details.inspection?.baseProfiles.length ?? 0} bases`,\n\t\t\t\t`${details.inspection?.models.length ?? 0} models`,\n\t\t\t],\n\t\t};\n\t}\n\treturn {\n\t\tlabel: \"worker profiles\",\n\t\taction: details.created ? \"created\" : \"rejected\",\n\t\tstatus: details.created ? \"success\" : \"warning\",\n\t\trows: details.profileId\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: \"succeeded\",\n\t\t\t\t\t\tlabel: details.profileId,\n\t\t\t\t\t\tmeta: details.baseProfileId ? [`base ${details.baseProfileId}`] : undefined,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: undefined,\n\t\temptyText: details.reason,\n\t};\n}\n\nexport function formatTaskProfileInspection(inspection: TaskProfileInspection): string {\n\tconst bases = inspection.baseProfiles.map((profile) => profile.profileId).join(\", \") || \"none\";\n\treturn `Reusable owner-authored bases for profile_create: ${bases}. Native delegate start does not need a base; omit profileId and set authority.role to explorer or implementer. profile_create requires an owner-authored explorer or implementer base. Available configured models: ${inspection.models.length}.`;\n}\n\nexport function executeDelegateProfileAction(\n\taction: DelegateProfileAction,\n\tinput: DelegateProfileInput,\n\twriter: TaskProfileWriterPort,\n): { content: Array<{ type: \"text\"; text: string }>; details: DelegateProfileToolDetails } {\n\tif (action === \"profile_inspect\") {\n\t\tconst inspection = writer.inspectTaskProfileOptions();\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: formatTaskProfileInspection(inspection),\n\t\t\t\t},\n\t\t\t],\n\t\t\tdetails: { started: true, action, kind: \"profile\", created: false, inspection },\n\t\t};\n\t}\n\n\tif (input.task === undefined) {\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\", text: \"delegate profile_create requires task\" }],\n\t\t\tdetails: {\n\t\t\t\tstarted: false,\n\t\t\t\taction,\n\t\t\t\tkind: \"profile\",\n\t\t\t\tcreated: false,\n\t\t\t\treason: \"missing_profile_task\",\n\t\t\t},\n\t\t};\n\t}\n\tconst request: TaskProfileCreateInput = {\n\t\ttask: input.task,\n\t\t...(input.baseProfileId !== undefined ? { baseProfileId: input.baseProfileId } : {}),\n\t\t...(input.model !== undefined ? { model: input.model } : {}),\n\t\t...(input.toolNames !== undefined ? { toolNames: input.toolNames } : {}),\n\t\t...(input.resourceProfileNames !== undefined ? { resourceProfileNames: input.resourceProfileNames } : {}),\n\t};\n\tconst result = writer.createTaskProfile(request);\n\treturn {\n\t\tcontent: [\n\t\t\t{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: result.created\n\t\t\t\t\t? `Created immutable session task profile ${result.profileId} from ${result.baseProfileId}.`\n\t\t\t\t\t: `delegate profile_create rejected the request: ${result.reason}.`,\n\t\t\t},\n\t\t],\n\t\tdetails: { started: result.created, action, kind: \"profile\", ...result },\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-store.d.ts","sourceRoot":"","sources":["../../../src/core/tools/secret-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EACN,KAAK,iBAAiB,EAEtB,KAAK,wBAAwB,EAE7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEN,KAAK,iCAAiC,EAEtC,MAAM,2CAA2C,CAAC;AAkCnD,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;EA6BtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAC1B,WAAW,GACX,WAAW,GACX,WAAW,GACX,OAAO,GACP,QAAQ,GACR,UAAU,GACV,aAAa,CAAC;AAEjB,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACtC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,uBAAuB,CAAC,EAAE,iCAAiC,CAAC;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|
@@ -138,7 +138,8 @@ export function createSecretStoreToolDefinition(options) {
|
|
|
138
138
|
promptSnippet: "Migrate accessible credentials into Bitwarden, activate project credentials; never expose values.",
|
|
139
139
|
promptGuidelines: [
|
|
140
140
|
"Active user-plane host gate authorizes model-blind migration; never ask duplicate confirmation.",
|
|
141
|
-
"
|
|
141
|
+
"Only when the current task genuinely requires credentials: call secret_store. Never probe or activate for an optional integration; its absence does not block unrelated work.",
|
|
142
|
+
"If required credentials are disconnected, TUI asks for one masked BW_SESSION only; never request chat/setup work.",
|
|
142
143
|
"activate before credential work; TUI/print/RPC return metadata only.",
|
|
143
144
|
"One project binding: omit profile. Multiple: use list, select authorized profile.",
|
|
144
145
|
"Never request credentials in chat/tool arguments.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-store.js","sourceRoot":"","sources":["../../../src/core/tools/secret-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAEN,sBAAsB,EAEtB,sBAAsB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,8BAA8B,EAE9B,iCAAiC,GACjC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,wCAAwC,EACxC,8BAA8B,GAC9B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3G,OAAO,EACN,sBAAsB,EACtB,2BAA2B,GAE3B,MAAM,0BAA0B,CAAC;AAElC,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC;IACxC,IAAI,CAAC,MAAM,CACV;QACC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;QACjC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,8BAA8B,EAAE,OAAO,EAAE,4BAA4B,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OAAO,MAAM,uBAAuB,EAAE,CAAC;gBACxC,CAAC;YACF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { defineTool } from \"../extensions/types.ts\";\nimport {\n\ttype CredentialManager,\n\tCredentialManagerError,\n\ttype CredentialProfileSummary,\n\tCredentialStorageError,\n} from \"../secrets/credential-manager.ts\";\nimport {\n\tCredentialMigrationSourceError,\n\ttype CredentialMigrationSourceResolver,\n\tresolveCredentialMigrationSources,\n} from \"../secrets/credential-migration-source.ts\";\nimport {\n\tconnectCredentialSessionWithMaskedPrompt,\n\tisCredentialSessionKeyRequired,\n} from \"../secrets/credential-session-connection.ts\";\nimport { SECRET_VARIABLE_NAME_MAX_CHARS, SECRET_VARIABLE_NAME_PATTERN } from \"../secrets/secret-dotenv.ts\";\nimport {\n\temptyOrchestrationCall,\n\tOrchestrationPanelComponent,\n\ttype OrchestrationPanelModel,\n} from \"./orchestration-panel.ts\";\n\nconst migrationSourceSchema = Type.Union([\n\tType.Object(\n\t\t{\n\t\t\tkind: Type.Literal(\"environment\"),\n\t\t\tname: Type.String({ maxLength: SECRET_VARIABLE_NAME_MAX_CHARS, pattern: SECRET_VARIABLE_NAME_PATTERN }),\n\t\t},\n\t\t{ additionalProperties: false },\n\t),\n\tType.Object(\n\t\t{ kind: Type.Literal(\"dotenv_file\"), path: Type.String({ minLength: 1, maxLength: 4096 }) },\n\t\t{ additionalProperties: false },\n\t),\n\tType.Object(\n\t\t{\n\t\t\tkind: Type.Literal(\"file\"),\n\t\t\tpath: Type.String({ minLength: 1, maxLength: 4096 }),\n\t\t\tvariable: Type.String({ maxLength: SECRET_VARIABLE_NAME_MAX_CHARS, pattern: SECRET_VARIABLE_NAME_PATTERN }),\n\t\t},\n\t\t{ additionalProperties: false },\n\t),\n]);\n\nconst secretStoreSchema = Type.Object(\n\t{\n\t\taction: Type.Union(\n\t\t\t[Type.Literal(\"status\"), Type.Literal(\"list\"), Type.Literal(\"activate\"), Type.Literal(\"migrate\")],\n\t\t\t{\n\t\t\t\tdescription: \"Inspect, activate, or migrate model-blind credential sources.\",\n\t\t\t},\n\t\t),\n\t\tprofile: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tminLength: 1,\n\t\t\t\tmaxLength: 96,\n\t\t\t\tpattern: \"^[A-Za-z0-9][A-Za-z0-9._-]*$\",\n\t\t\t\tdescription: \"Profile to activate or create during migration.\",\n\t\t\t}),\n\t\t),\n\t\tdescription: Type.Optional(Type.String({ minLength: 1, maxLength: 256 })),\n\t\toverwrite: Type.Optional(\n\t\t\tType.Boolean({ description: \"Explicitly replace an existing profile while preserving project bindings.\" }),\n\t\t),\n\t\tsources: Type.Optional(\n\t\t\tType.Array(migrationSourceSchema, {\n\t\t\t\tminItems: 1,\n\t\t\t\tmaxItems: 64,\n\t\t\t\tdescription: \"Host-side credential sources. Values are never accepted in tool arguments.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type SecretStoreToolInput = Static<typeof secretStoreSchema>;\n\nexport type SecretStoreStatus =\n\t| \"activated\"\n\t| \"available\"\n\t| \"cancelled\"\n\t| \"error\"\n\t| \"listed\"\n\t| \"migrated\"\n\t| \"unavailable\";\n\nexport interface SecretStoreToolDetails {\n\taction: SecretStoreToolInput[\"action\"];\n\tstatus: SecretStoreStatus;\n\tprofile?: string;\n\tvariableNames?: string[];\n\tprofiles?: CredentialProfileSummary[];\n\tproject?: string;\n\tconnected?: boolean;\n\tcode?: string;\n\tmessage?: string;\n\tsourceRetained?: boolean;\n}\n\nexport interface SecretStoreToolOptions {\n\tmanager: CredentialManager;\n\tresolveMigrationSources?: CredentialMigrationSourceResolver;\n}\n\ntype SecretStoreResult = {\n\tcontent: Array<{ type: \"text\"; text: string }>;\n\tdetails: SecretStoreToolDetails;\n};\n\nfunction result(details: SecretStoreToolDetails, text: string): SecretStoreResult {\n\treturn { content: [{ type: \"text\", text }], details };\n}\n\nfunction ownerSetupRequired(action: SecretStoreToolInput[\"action\"]): SecretStoreResult {\n\tconst message =\n\t\t\"Bitwarden needs one owner input: a BW_SESSION key supplied through Pi's masked prompt or process environment, never through chat.\";\n\treturn result(\n\t\t{\n\t\t\taction,\n\t\t\tstatus: \"unavailable\",\n\t\t\t...(action === \"status\" ? { connected: false } : {}),\n\t\t\tcode: \"owner_setup_required\",\n\t\t\tmessage,\n\t\t},\n\t\tmessage,\n\t);\n}\n\nfunction cancelled(action: SecretStoreToolInput[\"action\"]): SecretStoreResult {\n\treturn result({ action, status: \"cancelled\", code: \"cancelled\" }, \"Credential action cancelled.\");\n}\n\nfunction invalid(input: SecretStoreToolInput): SecretStoreResult | undefined {\n\tif (input.action === \"migrate\") {\n\t\tif (!input.profile || !input.sources) {\n\t\t\treturn result(\n\t\t\t\t{ action: input.action, status: \"error\", code: \"missing_migration_input\" },\n\t\t\t\t\"Credential migration requires a profile and at least one source.\",\n\t\t\t);\n\t\t}\n\t\treturn undefined;\n\t}\n\tif (input.description !== undefined || input.sources !== undefined || input.overwrite !== undefined) {\n\t\treturn result(\n\t\t\t{ action: input.action, status: \"error\", code: \"unexpected_migration_input\" },\n\t\t\t`Action ${input.action} does not accept migration inputs.`,\n\t\t);\n\t}\n\tif (input.action !== \"activate\" && input.profile !== undefined) {\n\t\treturn result(\n\t\t\t{\n\t\t\t\taction: input.action,\n\t\t\t\tstatus: \"error\",\n\t\t\t\tcode: \"unexpected_profile\",\n\t\t\t\tmessage: `Action ${input.action} does not accept a profile.`,\n\t\t\t},\n\t\t\t`Secret store request is invalid: action ${input.action} does not accept a profile.`,\n\t\t);\n\t}\n\treturn undefined;\n}\n\nfunction failed(input: SecretStoreToolInput, error: unknown): SecretStoreResult {\n\tconst known =\n\t\terror instanceof CredentialManagerError ||\n\t\terror instanceof CredentialStorageError ||\n\t\terror instanceof CredentialMigrationSourceError;\n\tconst code = known ? error.code : \"safe_failure\";\n\tconst migrationMessages: Record<string, string> = {\n\t\tduplicate_variable: \"Credential migration defines the same variable more than once.\",\n\t\tinvalid_source: \"Credential migration source data is invalid.\",\n\t\tsource_not_found: \"A requested credential source is unavailable.\",\n\t\tsource_unavailable: \"A requested credential source could not be read.\",\n\t};\n\tconst message =\n\t\terror instanceof CredentialMigrationSourceError\n\t\t\t? (migrationMessages[error.code] ?? \"Credential migration failed safely without exposing values.\")\n\t\t\t: known\n\t\t\t\t? error.message\n\t\t\t\t: \"Credential action failed safely without exposing values.\";\n\tconst status: SecretStoreStatus = [\"owner_setup_required\", \"not_connected\", \"provider_unavailable\"].includes(code)\n\t\t? \"unavailable\"\n\t\t: \"error\";\n\treturn result(\n\t\t{\n\t\t\taction: input.action,\n\t\t\tstatus,\n\t\t\t...(input.profile ? { profile: input.profile } : {}),\n\t\t\tcode,\n\t\t\tmessage,\n\t\t},\n\t\t`Credential action failed: ${message}`,\n\t);\n}\n\nfunction panelModel(details: SecretStoreToolDetails | undefined, expanded: boolean): OrchestrationPanelModel {\n\tif (!details) return { label: \"secrets\", status: \"error\", emptyText: \"No credential result was retained.\" };\n\tconst success = [\"activated\", \"available\", \"listed\", \"migrated\"].includes(details.status);\n\treturn {\n\t\tlabel: \"secrets\",\n\t\taction: details.status,\n\t\tstatus: success ? \"success\" : details.status === \"cancelled\" ? \"warning\" : \"error\",\n\t\tsummary: [\n\t\t\tdetails.profile,\n\t\t\tdetails.project,\n\t\t\tdetails.variableNames\n\t\t\t\t? `${details.variableNames.length} variable${details.variableNames.length === 1 ? \"\" : \"s\"}`\n\t\t\t\t: undefined,\n\t\t\tdetails.profiles ? `${details.profiles.length} profile${details.profiles.length === 1 ? \"\" : \"s\"}` : undefined,\n\t\t].filter((value): value is string => value !== undefined),\n\t\trows: expanded\n\t\t\t? details.profiles?.map((profile) => ({\n\t\t\t\t\tstatus: profile.boundToCurrentProject ? (\"succeeded\" as const) : (\"info\" as const),\n\t\t\t\t\tlabel: profile.profile,\n\t\t\t\t\tmeta: [\n\t\t\t\t\t\t`${profile.variableNames.length} variable${profile.variableNames.length === 1 ? \"\" : \"s\"}`,\n\t\t\t\t\t\tprofile.boundToCurrentProject ? \"bound here\" : \"not bound here\",\n\t\t\t\t\t],\n\t\t\t\t\tdetails: profile.description ? [profile.description] : undefined,\n\t\t\t\t}))\n\t\t\t: undefined,\n\t\tnotices:\n\t\t\texpanded && details.message ? [{ status: success ? \"info\" : \"error\", text: details.message }] : undefined,\n\t};\n}\n\nexport function createSecretStoreToolDefinition(options: SecretStoreToolOptions) {\n\tconst { manager } = options;\n\tconst resolveSources = options.resolveMigrationSources ?? resolveCredentialMigrationSources;\n\treturn defineTool<typeof secretStoreSchema, SecretStoreToolDetails>({\n\t\tname: \"secret_store\",\n\t\tlabel: \"Secret Store\",\n\t\tdescription:\n\t\t\t\"Discover, migrate, and activate Bitwarden credential profiles for the current project without exposing values.\",\n\t\tpromptSnippet:\n\t\t\t\"Migrate accessible credentials into Bitwarden, activate project credentials; never expose values.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Active user-plane host gate authorizes model-blind migration; never ask duplicate confirmation.\",\n\t\t\t\"Credentials needed: call secret_store. If disconnected, TUI asks for one masked BW_SESSION only; never request chat/setup work.\",\n\t\t\t\"activate before credential work; TUI/print/RPC return metadata only.\",\n\t\t\t\"One project binding: omit profile. Multiple: use list, select authorized profile.\",\n\t\t\t\"Never request credentials in chat/tool arguments.\",\n\t\t\t\"After activation, run consumer normally; never print/inspect/grep/echo credential environment values.\",\n\t\t\t\"migrate accepts environment names, dotenv paths, key-file paths; never credential values.\",\n\t\t\t\"Migration keeps sources. overwrite only for intentional Bitwarden profile replacement.\",\n\t\t\t\"owner_setup_required without UI: report only BW_SESSION missing, supplied out of band to Pi; never request more/retry.\",\n\t\t],\n\t\tparameters: secretStoreSchema,\n\t\texecutionMode: \"sequential\",\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(toolResult, { expanded, isPartial }, theme: Theme) {\n\t\t\tif (isPartial) {\n\t\t\t\treturn new OrchestrationPanelComponent(theme, {\n\t\t\t\t\tlabel: \"secrets\",\n\t\t\t\t\taction: \"activating\",\n\t\t\t\t\tstatus: \"running\",\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn new OrchestrationPanelComponent(theme, panelModel(toolResult.details, expanded), expanded);\n\t\t},\n\t\tasync execute(_toolCallId, input, signal, _onUpdate, ctx) {\n\t\t\tif (signal?.aborted) {\n\t\t\t\treturn cancelled(input.action);\n\t\t\t}\n\t\t\tconst validation = invalid(input);\n\t\t\tif (validation) return validation;\n\t\t\ttry {\n\t\t\t\tif (input.action === \"status\") {\n\t\t\t\t\tconst status = manager.status;\n\t\t\t\t\tif (!status.sessionAvailable) return ownerSetupRequired(input.action);\n\t\t\t\t\treturn result(\n\t\t\t\t\t\t{ action: input.action, status: \"available\", connected: status.connected },\n\t\t\t\t\t\tstatus.connected\n\t\t\t\t\t\t\t? \"Bitwarden is connected for this Pi session.\"\n\t\t\t\t\t\t\t: \"A Bitwarden session key is available and will be validated on activation.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst executeCredentialAction = async (): Promise<SecretStoreResult> => {\n\t\t\t\t\tif (input.action === \"list\") {\n\t\t\t\t\t\tconst profiles = await manager.listForProject(ctx.cwd, signal);\n\t\t\t\t\t\treturn result(\n\t\t\t\t\t\t\t{ action: input.action, status: \"listed\", profiles },\n\t\t\t\t\t\t\t`Found ${profiles.length} credential profile${profiles.length === 1 ? \"\" : \"s\"}; only metadata was returned.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (input.action === \"migrate\") {\n\t\t\t\t\t\tconst { profile, sources } = input;\n\t\t\t\t\t\tif (!profile || !sources) {\n\t\t\t\t\t\t\treturn result(\n\t\t\t\t\t\t\t\t{ action: input.action, status: \"error\", code: \"missing_migration_input\" },\n\t\t\t\t\t\t\t\t\"Credential migration requires a profile and at least one source.\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait manager.prepareForMigration(\n\t\t\t\t\t\t\tctx.cwd,\n\t\t\t\t\t\t\t{ profile, replaceExisting: input.overwrite === true },\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet variables = await resolveSources(sources, ctx.cwd, signal);\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst migrated = await manager.storeVariablesForProject(\n\t\t\t\t\t\t\t\tctx.cwd,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tprofile,\n\t\t\t\t\t\t\t\t\t...(input.description ? { description: input.description } : {}),\n\t\t\t\t\t\t\t\t\tvariables,\n\t\t\t\t\t\t\t\t\treplaceExisting: input.overwrite === true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn result(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\taction: input.action,\n\t\t\t\t\t\t\t\t\tstatus: \"migrated\",\n\t\t\t\t\t\t\t\t\tprofile: migrated.profile,\n\t\t\t\t\t\t\t\t\tvariableNames: migrated.variableNames,\n\t\t\t\t\t\t\t\t\tproject: migrated.project,\n\t\t\t\t\t\t\t\t\tsourceRetained: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t`Migrated and activated ${migrated.profile} for ${migrated.project}. Source material was retained.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tfor (const variable of variables) variable.value = \"\";\n\t\t\t\t\t\t\tvariables = [];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst activated = await manager.activateForProject(ctx.cwd, input.profile, signal);\n\t\t\t\t\treturn result(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\taction: input.action,\n\t\t\t\t\t\t\tstatus: \"activated\",\n\t\t\t\t\t\t\tprofile: activated.profile,\n\t\t\t\t\t\t\tvariableNames: activated.variableNames,\n\t\t\t\t\t\t\tproject: activated.project,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t`Activated ${activated.profile} for ${activated.project}. Credential values remain hidden.`,\n\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tconst connectWithOwnerKey = async (): Promise<SecretStoreResult | undefined> => {\n\t\t\t\t\tif (!ctx.hasUI) return ownerSetupRequired(input.action);\n\t\t\t\t\tconst connection = await connectCredentialSessionWithMaskedPrompt(manager, ctx.ui, signal);\n\t\t\t\t\treturn connection === \"connected\" ? undefined : cancelled(input.action);\n\t\t\t\t};\n\n\t\t\t\tif (!manager.status.sessionAvailable) {\n\t\t\t\t\tconst setup = await connectWithOwnerKey();\n\t\t\t\t\tif (setup) return setup;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\treturn await executeCredentialAction();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!isCredentialSessionKeyRequired(error)) throw error;\n\t\t\t\t\tconst setup = await connectWithOwnerKey();\n\t\t\t\t\tif (setup) return setup;\n\t\t\t\t\treturn await executeCredentialAction();\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\treturn failed(input, error);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"secret-store.js","sourceRoot":"","sources":["../../../src/core/tools/secret-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAEN,sBAAsB,EAEtB,sBAAsB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,8BAA8B,EAE9B,iCAAiC,GACjC,MAAM,2CAA2C,CAAC;AACnD,OAAO,E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OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;oBACtC,MAAM,KAAK,GAAG,MAAM,mBAAmB,EAAE,CAAC;oBAC1C,IAAI,KAAK;wBAAE,OAAO,KAAK,CAAC;gBACzB,CAAC;gBACD,IAAI,CAAC;oBACJ,OAAO,MAAM,uBAAuB,EAAE,CAAC;gBACxC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,IAAI,CAAC,8BAA8B,CAAC,KAAK,CAAC;wBAAE,MAAM,KAAK,CAAC;oBACxD,MAAM,KAAK,GAAG,MAAM,mBAAmB,EAAE,CAAC;oBAC1C,IAAI,KAAK;wBAAE,OAAO,KAAK,CAAC;oBACxB,OAAO,MAAM,uBAAuB,EAAE,CAAC;gBACxC,CAAC;YACF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { defineTool } from \"../extensions/types.ts\";\nimport {\n\ttype CredentialManager,\n\tCredentialManagerError,\n\ttype CredentialProfileSummary,\n\tCredentialStorageError,\n} from \"../secrets/credential-manager.ts\";\nimport {\n\tCredentialMigrationSourceError,\n\ttype CredentialMigrationSourceResolver,\n\tresolveCredentialMigrationSources,\n} from \"../secrets/credential-migration-source.ts\";\nimport {\n\tconnectCredentialSessionWithMaskedPrompt,\n\tisCredentialSessionKeyRequired,\n} from \"../secrets/credential-session-connection.ts\";\nimport { SECRET_VARIABLE_NAME_MAX_CHARS, SECRET_VARIABLE_NAME_PATTERN } from \"../secrets/secret-dotenv.ts\";\nimport {\n\temptyOrchestrationCall,\n\tOrchestrationPanelComponent,\n\ttype OrchestrationPanelModel,\n} from \"./orchestration-panel.ts\";\n\nconst migrationSourceSchema = Type.Union([\n\tType.Object(\n\t\t{\n\t\t\tkind: Type.Literal(\"environment\"),\n\t\t\tname: Type.String({ maxLength: SECRET_VARIABLE_NAME_MAX_CHARS, pattern: SECRET_VARIABLE_NAME_PATTERN }),\n\t\t},\n\t\t{ additionalProperties: false },\n\t),\n\tType.Object(\n\t\t{ kind: Type.Literal(\"dotenv_file\"), path: Type.String({ minLength: 1, maxLength: 4096 }) },\n\t\t{ additionalProperties: false },\n\t),\n\tType.Object(\n\t\t{\n\t\t\tkind: Type.Literal(\"file\"),\n\t\t\tpath: Type.String({ minLength: 1, maxLength: 4096 }),\n\t\t\tvariable: Type.String({ maxLength: SECRET_VARIABLE_NAME_MAX_CHARS, pattern: SECRET_VARIABLE_NAME_PATTERN }),\n\t\t},\n\t\t{ additionalProperties: false },\n\t),\n]);\n\nconst secretStoreSchema = Type.Object(\n\t{\n\t\taction: Type.Union(\n\t\t\t[Type.Literal(\"status\"), Type.Literal(\"list\"), Type.Literal(\"activate\"), Type.Literal(\"migrate\")],\n\t\t\t{\n\t\t\t\tdescription: \"Inspect, activate, or migrate model-blind credential sources.\",\n\t\t\t},\n\t\t),\n\t\tprofile: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tminLength: 1,\n\t\t\t\tmaxLength: 96,\n\t\t\t\tpattern: \"^[A-Za-z0-9][A-Za-z0-9._-]*$\",\n\t\t\t\tdescription: \"Profile to activate or create during migration.\",\n\t\t\t}),\n\t\t),\n\t\tdescription: Type.Optional(Type.String({ minLength: 1, maxLength: 256 })),\n\t\toverwrite: Type.Optional(\n\t\t\tType.Boolean({ description: \"Explicitly replace an existing profile while preserving project bindings.\" }),\n\t\t),\n\t\tsources: Type.Optional(\n\t\t\tType.Array(migrationSourceSchema, {\n\t\t\t\tminItems: 1,\n\t\t\t\tmaxItems: 64,\n\t\t\t\tdescription: \"Host-side credential sources. Values are never accepted in tool arguments.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type SecretStoreToolInput = Static<typeof secretStoreSchema>;\n\nexport type SecretStoreStatus =\n\t| \"activated\"\n\t| \"available\"\n\t| \"cancelled\"\n\t| \"error\"\n\t| \"listed\"\n\t| \"migrated\"\n\t| \"unavailable\";\n\nexport interface SecretStoreToolDetails {\n\taction: SecretStoreToolInput[\"action\"];\n\tstatus: SecretStoreStatus;\n\tprofile?: string;\n\tvariableNames?: string[];\n\tprofiles?: CredentialProfileSummary[];\n\tproject?: string;\n\tconnected?: boolean;\n\tcode?: string;\n\tmessage?: string;\n\tsourceRetained?: boolean;\n}\n\nexport interface SecretStoreToolOptions {\n\tmanager: CredentialManager;\n\tresolveMigrationSources?: CredentialMigrationSourceResolver;\n}\n\ntype SecretStoreResult = {\n\tcontent: Array<{ type: \"text\"; text: string }>;\n\tdetails: SecretStoreToolDetails;\n};\n\nfunction result(details: SecretStoreToolDetails, text: string): SecretStoreResult {\n\treturn { content: [{ type: \"text\", text }], details };\n}\n\nfunction ownerSetupRequired(action: SecretStoreToolInput[\"action\"]): SecretStoreResult {\n\tconst message =\n\t\t\"Bitwarden needs one owner input: a BW_SESSION key supplied through Pi's masked prompt or process environment, never through chat.\";\n\treturn result(\n\t\t{\n\t\t\taction,\n\t\t\tstatus: \"unavailable\",\n\t\t\t...(action === \"status\" ? { connected: false } : {}),\n\t\t\tcode: \"owner_setup_required\",\n\t\t\tmessage,\n\t\t},\n\t\tmessage,\n\t);\n}\n\nfunction cancelled(action: SecretStoreToolInput[\"action\"]): SecretStoreResult {\n\treturn result({ action, status: \"cancelled\", code: \"cancelled\" }, \"Credential action cancelled.\");\n}\n\nfunction invalid(input: SecretStoreToolInput): SecretStoreResult | undefined {\n\tif (input.action === \"migrate\") {\n\t\tif (!input.profile || !input.sources) {\n\t\t\treturn result(\n\t\t\t\t{ action: input.action, status: \"error\", code: \"missing_migration_input\" },\n\t\t\t\t\"Credential migration requires a profile and at least one source.\",\n\t\t\t);\n\t\t}\n\t\treturn undefined;\n\t}\n\tif (input.description !== undefined || input.sources !== undefined || input.overwrite !== undefined) {\n\t\treturn result(\n\t\t\t{ action: input.action, status: \"error\", code: \"unexpected_migration_input\" },\n\t\t\t`Action ${input.action} does not accept migration inputs.`,\n\t\t);\n\t}\n\tif (input.action !== \"activate\" && input.profile !== undefined) {\n\t\treturn result(\n\t\t\t{\n\t\t\t\taction: input.action,\n\t\t\t\tstatus: \"error\",\n\t\t\t\tcode: \"unexpected_profile\",\n\t\t\t\tmessage: `Action ${input.action} does not accept a profile.`,\n\t\t\t},\n\t\t\t`Secret store request is invalid: action ${input.action} does not accept a profile.`,\n\t\t);\n\t}\n\treturn undefined;\n}\n\nfunction failed(input: SecretStoreToolInput, error: unknown): SecretStoreResult {\n\tconst known =\n\t\terror instanceof CredentialManagerError ||\n\t\terror instanceof CredentialStorageError ||\n\t\terror instanceof CredentialMigrationSourceError;\n\tconst code = known ? error.code : \"safe_failure\";\n\tconst migrationMessages: Record<string, string> = {\n\t\tduplicate_variable: \"Credential migration defines the same variable more than once.\",\n\t\tinvalid_source: \"Credential migration source data is invalid.\",\n\t\tsource_not_found: \"A requested credential source is unavailable.\",\n\t\tsource_unavailable: \"A requested credential source could not be read.\",\n\t};\n\tconst message =\n\t\terror instanceof CredentialMigrationSourceError\n\t\t\t? (migrationMessages[error.code] ?? \"Credential migration failed safely without exposing values.\")\n\t\t\t: known\n\t\t\t\t? error.message\n\t\t\t\t: \"Credential action failed safely without exposing values.\";\n\tconst status: SecretStoreStatus = [\"owner_setup_required\", \"not_connected\", \"provider_unavailable\"].includes(code)\n\t\t? \"unavailable\"\n\t\t: \"error\";\n\treturn result(\n\t\t{\n\t\t\taction: input.action,\n\t\t\tstatus,\n\t\t\t...(input.profile ? { profile: input.profile } : {}),\n\t\t\tcode,\n\t\t\tmessage,\n\t\t},\n\t\t`Credential action failed: ${message}`,\n\t);\n}\n\nfunction panelModel(details: SecretStoreToolDetails | undefined, expanded: boolean): OrchestrationPanelModel {\n\tif (!details) return { label: \"secrets\", status: \"error\", emptyText: \"No credential result was retained.\" };\n\tconst success = [\"activated\", \"available\", \"listed\", \"migrated\"].includes(details.status);\n\treturn {\n\t\tlabel: \"secrets\",\n\t\taction: details.status,\n\t\tstatus: success ? \"success\" : details.status === \"cancelled\" ? \"warning\" : \"error\",\n\t\tsummary: [\n\t\t\tdetails.profile,\n\t\t\tdetails.project,\n\t\t\tdetails.variableNames\n\t\t\t\t? `${details.variableNames.length} variable${details.variableNames.length === 1 ? \"\" : \"s\"}`\n\t\t\t\t: undefined,\n\t\t\tdetails.profiles ? `${details.profiles.length} profile${details.profiles.length === 1 ? \"\" : \"s\"}` : undefined,\n\t\t].filter((value): value is string => value !== undefined),\n\t\trows: expanded\n\t\t\t? details.profiles?.map((profile) => ({\n\t\t\t\t\tstatus: profile.boundToCurrentProject ? (\"succeeded\" as const) : (\"info\" as const),\n\t\t\t\t\tlabel: profile.profile,\n\t\t\t\t\tmeta: [\n\t\t\t\t\t\t`${profile.variableNames.length} variable${profile.variableNames.length === 1 ? \"\" : \"s\"}`,\n\t\t\t\t\t\tprofile.boundToCurrentProject ? \"bound here\" : \"not bound here\",\n\t\t\t\t\t],\n\t\t\t\t\tdetails: profile.description ? [profile.description] : undefined,\n\t\t\t\t}))\n\t\t\t: undefined,\n\t\tnotices:\n\t\t\texpanded && details.message ? [{ status: success ? \"info\" : \"error\", text: details.message }] : undefined,\n\t};\n}\n\nexport function createSecretStoreToolDefinition(options: SecretStoreToolOptions) {\n\tconst { manager } = options;\n\tconst resolveSources = options.resolveMigrationSources ?? resolveCredentialMigrationSources;\n\treturn defineTool<typeof secretStoreSchema, SecretStoreToolDetails>({\n\t\tname: \"secret_store\",\n\t\tlabel: \"Secret Store\",\n\t\tdescription:\n\t\t\t\"Discover, migrate, and activate Bitwarden credential profiles for the current project without exposing values.\",\n\t\tpromptSnippet:\n\t\t\t\"Migrate accessible credentials into Bitwarden, activate project credentials; never expose values.\",\n\t\tpromptGuidelines: [\n\t\t\t\"Active user-plane host gate authorizes model-blind migration; never ask duplicate confirmation.\",\n\t\t\t\"Only when the current task genuinely requires credentials: call secret_store. Never probe or activate for an optional integration; its absence does not block unrelated work.\",\n\t\t\t\"If required credentials are disconnected, TUI asks for one masked BW_SESSION only; never request chat/setup work.\",\n\t\t\t\"activate before credential work; TUI/print/RPC return metadata only.\",\n\t\t\t\"One project binding: omit profile. Multiple: use list, select authorized profile.\",\n\t\t\t\"Never request credentials in chat/tool arguments.\",\n\t\t\t\"After activation, run consumer normally; never print/inspect/grep/echo credential environment values.\",\n\t\t\t\"migrate accepts environment names, dotenv paths, key-file paths; never credential values.\",\n\t\t\t\"Migration keeps sources. overwrite only for intentional Bitwarden profile replacement.\",\n\t\t\t\"owner_setup_required without UI: report only BW_SESSION missing, supplied out of band to Pi; never request more/retry.\",\n\t\t],\n\t\tparameters: secretStoreSchema,\n\t\texecutionMode: \"sequential\",\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(toolResult, { expanded, isPartial }, theme: Theme) {\n\t\t\tif (isPartial) {\n\t\t\t\treturn new OrchestrationPanelComponent(theme, {\n\t\t\t\t\tlabel: \"secrets\",\n\t\t\t\t\taction: \"activating\",\n\t\t\t\t\tstatus: \"running\",\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn new OrchestrationPanelComponent(theme, panelModel(toolResult.details, expanded), expanded);\n\t\t},\n\t\tasync execute(_toolCallId, input, signal, _onUpdate, ctx) {\n\t\t\tif (signal?.aborted) {\n\t\t\t\treturn cancelled(input.action);\n\t\t\t}\n\t\t\tconst validation = invalid(input);\n\t\t\tif (validation) return validation;\n\t\t\ttry {\n\t\t\t\tif (input.action === \"status\") {\n\t\t\t\t\tconst status = manager.status;\n\t\t\t\t\tif (!status.sessionAvailable) return ownerSetupRequired(input.action);\n\t\t\t\t\treturn result(\n\t\t\t\t\t\t{ action: input.action, status: \"available\", connected: status.connected },\n\t\t\t\t\t\tstatus.connected\n\t\t\t\t\t\t\t? \"Bitwarden is connected for this Pi session.\"\n\t\t\t\t\t\t\t: \"A Bitwarden session key is available and will be validated on activation.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst executeCredentialAction = async (): Promise<SecretStoreResult> => {\n\t\t\t\t\tif (input.action === \"list\") {\n\t\t\t\t\t\tconst profiles = await manager.listForProject(ctx.cwd, signal);\n\t\t\t\t\t\treturn result(\n\t\t\t\t\t\t\t{ action: input.action, status: \"listed\", profiles },\n\t\t\t\t\t\t\t`Found ${profiles.length} credential profile${profiles.length === 1 ? \"\" : \"s\"}; only metadata was returned.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (input.action === \"migrate\") {\n\t\t\t\t\t\tconst { profile, sources } = input;\n\t\t\t\t\t\tif (!profile || !sources) {\n\t\t\t\t\t\t\treturn result(\n\t\t\t\t\t\t\t\t{ action: input.action, status: \"error\", code: \"missing_migration_input\" },\n\t\t\t\t\t\t\t\t\"Credential migration requires a profile and at least one source.\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait manager.prepareForMigration(\n\t\t\t\t\t\t\tctx.cwd,\n\t\t\t\t\t\t\t{ profile, replaceExisting: input.overwrite === true },\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet variables = await resolveSources(sources, ctx.cwd, signal);\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst migrated = await manager.storeVariablesForProject(\n\t\t\t\t\t\t\t\tctx.cwd,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tprofile,\n\t\t\t\t\t\t\t\t\t...(input.description ? { description: input.description } : {}),\n\t\t\t\t\t\t\t\t\tvariables,\n\t\t\t\t\t\t\t\t\treplaceExisting: input.overwrite === true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn result(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\taction: input.action,\n\t\t\t\t\t\t\t\t\tstatus: \"migrated\",\n\t\t\t\t\t\t\t\t\tprofile: migrated.profile,\n\t\t\t\t\t\t\t\t\tvariableNames: migrated.variableNames,\n\t\t\t\t\t\t\t\t\tproject: migrated.project,\n\t\t\t\t\t\t\t\t\tsourceRetained: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t`Migrated and activated ${migrated.profile} for ${migrated.project}. Source material was retained.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tfor (const variable of variables) variable.value = \"\";\n\t\t\t\t\t\t\tvariables = [];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst activated = await manager.activateForProject(ctx.cwd, input.profile, signal);\n\t\t\t\t\treturn result(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\taction: input.action,\n\t\t\t\t\t\t\tstatus: \"activated\",\n\t\t\t\t\t\t\tprofile: activated.profile,\n\t\t\t\t\t\t\tvariableNames: activated.variableNames,\n\t\t\t\t\t\t\tproject: activated.project,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t`Activated ${activated.profile} for ${activated.project}. Credential values remain hidden.`,\n\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tconst connectWithOwnerKey = async (): Promise<SecretStoreResult | undefined> => {\n\t\t\t\t\tif (!ctx.hasUI) return ownerSetupRequired(input.action);\n\t\t\t\t\tconst connection = await connectCredentialSessionWithMaskedPrompt(manager, ctx.ui, signal);\n\t\t\t\t\treturn connection === \"connected\" ? undefined : cancelled(input.action);\n\t\t\t\t};\n\n\t\t\t\tif (!manager.status.sessionAvailable) {\n\t\t\t\t\tconst setup = await connectWithOwnerKey();\n\t\t\t\t\tif (setup) return setup;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\treturn await executeCredentialAction();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!isCredentialSessionKeyRequired(error)) throw error;\n\t\t\t\t\tconst setup = await connectWithOwnerKey();\n\t\t\t\t\tif (setup) return setup;\n\t\t\t\t\treturn await executeCredentialAction();\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\treturn failed(input, error);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-session.d.ts","sourceRoot":"","sources":["../../../src/core/tools/shell-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAS,MAAM,eAAe,CAAC;AAS5E,OAAO,EAIN,KAAK,qBAAqB,EAE1B,KAAK,WAAW,EAChB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACN,+BAA+B,EAC/B,sCAAsC,GACtC,MAAM,4CAA4C,CAAC;AASpD,MAAM,WAAW,uBAAuB;IACvC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,kGAAkG;IAClG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,6BAA6B;IAC7C,2BAA2B,CAAC,EAAE,MAAM,WAAW,EAAE,CAAC;IAClD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,KAAK,YAAY,CAAC;IACjF,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AAUD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAUzF;AAED,iHAAiH;AACjH,wBAAgB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