@mcoda/mswarm 0.1.135-codali.2 → 0.1.135-codali.29
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/README.md +5 -0
- package/dist/codali-executor.d.ts +13 -0
- package/dist/codali-executor.d.ts.map +1 -1
- package/dist/codali-executor.js +46 -2
- package/dist/codali-executor.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +11 -4
- package/dist/runtime.js.map +1 -1
- package/dist/vendor/codali/cli/TerminalArtifacts.d.ts +5 -0
- package/dist/vendor/codali/cli/TerminalArtifacts.d.ts.map +1 -0
- package/dist/vendor/codali/cli/TerminalArtifacts.js +26 -0
- package/dist/vendor/codali/cli/TerminalCommand.d.ts.map +1 -1
- package/dist/vendor/codali/cli/TerminalCommand.js +411 -75
- package/dist/vendor/codali/cli/TerminalCredentials.js +2 -2
- package/dist/vendor/codali/cli/TerminalInput.d.ts +13 -0
- package/dist/vendor/codali/cli/TerminalInput.d.ts.map +1 -1
- package/dist/vendor/codali/cli/TerminalInput.js +55 -7
- package/dist/vendor/codali/cli/TerminalModels.d.ts +6 -0
- package/dist/vendor/codali/cli/TerminalModels.d.ts.map +1 -0
- package/dist/vendor/codali/cli/TerminalModels.js +45 -0
- package/dist/vendor/codali/cli/TerminalPlan.d.ts +40 -0
- package/dist/vendor/codali/cli/TerminalPlan.d.ts.map +1 -0
- package/dist/vendor/codali/cli/TerminalPlan.js +37 -0
- package/dist/vendor/codali/cli/ToolsCommand.d.ts.map +1 -1
- package/dist/vendor/codali/cli/ToolsCommand.js +8 -1
- package/dist/vendor/codali/cli/tui/TerminalCells.d.ts +6 -0
- package/dist/vendor/codali/cli/tui/TerminalCells.d.ts.map +1 -0
- package/dist/vendor/codali/cli/tui/TerminalCells.js +47 -0
- package/dist/vendor/codali/cli/tui/TerminalEditor.d.ts +22 -0
- package/dist/vendor/codali/cli/tui/TerminalEditor.d.ts.map +1 -0
- package/dist/vendor/codali/cli/tui/TerminalEditor.js +88 -0
- package/dist/vendor/codali/cli/tui/TerminalLogo.d.ts +6 -0
- package/dist/vendor/codali/cli/tui/TerminalLogo.d.ts.map +1 -0
- package/dist/vendor/codali/cli/tui/TerminalLogo.js +26 -0
- package/dist/vendor/codali/cli/tui/TerminalMarkdown.d.ts +5 -0
- package/dist/vendor/codali/cli/tui/TerminalMarkdown.d.ts.map +1 -0
- package/dist/vendor/codali/cli/tui/TerminalMarkdown.js +118 -0
- package/dist/vendor/codali/cli/tui/TerminalPresentation.d.ts +4 -0
- package/dist/vendor/codali/cli/tui/TerminalPresentation.d.ts.map +1 -0
- package/dist/vendor/codali/cli/tui/TerminalPresentation.js +77 -0
- package/dist/vendor/codali/cli/tui/TerminalScreen.d.ts +50 -0
- package/dist/vendor/codali/cli/tui/TerminalScreen.d.ts.map +1 -0
- package/dist/vendor/codali/cli/tui/TerminalScreen.js +137 -0
- package/dist/vendor/codali/cli/tui/TerminalSelection.d.ts +15 -0
- package/dist/vendor/codali/cli/tui/TerminalSelection.d.ts.map +1 -0
- package/dist/vendor/codali/cli/tui/TerminalSelection.js +38 -0
- package/dist/vendor/codali/cli/tui/TerminalTui.d.ts +82 -0
- package/dist/vendor/codali/cli/tui/TerminalTui.d.ts.map +1 -0
- package/dist/vendor/codali/cli/tui/TerminalTui.js +553 -0
- package/dist/vendor/codali/cli.d.ts.map +1 -1
- package/dist/vendor/codali/cli.js +5 -3
- package/dist/vendor/codali/config/OrchestrationConfig.d.ts +33 -0
- package/dist/vendor/codali/config/OrchestrationConfig.d.ts.map +1 -1
- package/dist/vendor/codali/config/OrchestrationConfig.js +59 -1
- package/dist/vendor/codali/connectors/media/MediaJobStore.d.ts +2 -1
- package/dist/vendor/codali/connectors/media/MediaJobStore.d.ts.map +1 -1
- package/dist/vendor/codali/connectors/media/MediaJobStore.js +11 -3
- package/dist/vendor/codali/docdex/DocdexCatalog.d.ts +12 -0
- package/dist/vendor/codali/docdex/DocdexCatalog.d.ts.map +1 -0
- package/dist/vendor/codali/docdex/DocdexCatalog.js +30 -0
- package/dist/vendor/codali/docdex/DocdexClient.d.ts +8 -2
- package/dist/vendor/codali/docdex/DocdexClient.d.ts.map +1 -1
- package/dist/vendor/codali/docdex/DocdexClient.js +86 -11
- package/dist/vendor/codali/docdex/ManagedDocdex.d.ts +1 -0
- package/dist/vendor/codali/docdex/ManagedDocdex.d.ts.map +1 -1
- package/dist/vendor/codali/docdex/ManagedDocdex.js +25 -4
- package/dist/vendor/codali/eval/TerminalWorkflowCorpus.d.ts +1 -1
- package/dist/vendor/codali/eval/TerminalWorkflowCorpus.d.ts.map +1 -1
- package/dist/vendor/codali/eval/TerminalWorkflowCorpus.js +9 -6
- package/dist/vendor/codali/eval/TrustBenchmark.d.ts +94 -0
- package/dist/vendor/codali/eval/TrustBenchmark.d.ts.map +1 -0
- package/dist/vendor/codali/eval/TrustBenchmark.js +199 -0
- package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.d.ts +4 -0
- package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.d.ts.map +1 -0
- package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.js +10 -0
- package/dist/vendor/codali/eval/fixtures/MixedMediaRecoveryJourney.d.ts +6 -0
- package/dist/vendor/codali/eval/fixtures/MixedMediaRecoveryJourney.d.ts.map +1 -0
- package/dist/vendor/codali/eval/fixtures/MixedMediaRecoveryJourney.js +145 -0
- package/dist/vendor/codali/eval/fixtures/TerminalRecoveryJourney.d.ts.map +1 -1
- package/dist/vendor/codali/eval/fixtures/TerminalRecoveryJourney.js +14 -1
- package/dist/vendor/codali/index.d.ts +1 -0
- package/dist/vendor/codali/index.d.ts.map +1 -1
- package/dist/vendor/codali/index.js +1 -0
- package/dist/vendor/codali/permissions/PermissionGate.d.ts +1 -1
- package/dist/vendor/codali/permissions/PermissionGate.d.ts.map +1 -1
- package/dist/vendor/codali/permissions/PermissionGate.js +40 -2
- package/dist/vendor/codali/permissions/WorkspacePermissions.d.ts +11 -0
- package/dist/vendor/codali/permissions/WorkspacePermissions.d.ts.map +1 -0
- package/dist/vendor/codali/permissions/WorkspacePermissions.js +42 -0
- package/dist/vendor/codali/providers/ConfiguredModelScope.d.ts +1 -0
- package/dist/vendor/codali/providers/ConfiguredModelScope.d.ts.map +1 -1
- package/dist/vendor/codali/providers/ConfiguredModelScope.js +17 -1
- package/dist/vendor/codali/providers/ConfiguredProvider.d.ts +5 -0
- package/dist/vendor/codali/providers/ConfiguredProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/ConfiguredProvider.js +38 -5
- package/dist/vendor/codali/providers/ModelServiceError.d.ts +7 -2
- package/dist/vendor/codali/providers/ModelServiceError.d.ts.map +1 -1
- package/dist/vendor/codali/providers/ModelServiceError.js +28 -4
- package/dist/vendor/codali/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/OpenAiCompatibleProvider.js +9 -1
- package/dist/vendor/codali/providers/ProviderTypes.d.ts +2 -0
- package/dist/vendor/codali/providers/ProviderTypes.d.ts.map +1 -1
- package/dist/vendor/codali/providers/RequestUsage.d.ts +11 -0
- package/dist/vendor/codali/providers/RequestUsage.d.ts.map +1 -0
- package/dist/vendor/codali/providers/RequestUsage.js +33 -0
- package/dist/vendor/codali/runtime/CodaliRuntime.d.ts +1 -0
- package/dist/vendor/codali/runtime/CodaliRuntime.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/CodaliRuntime.js +1 -0
- package/dist/vendor/codali/runtime/ComputedAnswer.d.ts +13 -0
- package/dist/vendor/codali/runtime/ComputedAnswer.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/ComputedAnswer.js +75 -0
- package/dist/vendor/codali/runtime/ContextCompression.d.ts +22 -0
- package/dist/vendor/codali/runtime/ContextCompression.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/ContextCompression.js +53 -0
- package/dist/vendor/codali/runtime/InspectionBudget.d.ts +8 -0
- package/dist/vendor/codali/runtime/InspectionBudget.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/InspectionBudget.js +25 -0
- package/dist/vendor/codali/runtime/InteractionContract.d.ts +42 -0
- package/dist/vendor/codali/runtime/InteractionContract.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/InteractionContract.js +50 -0
- package/dist/vendor/codali/runtime/InteractionRouter.d.ts +71 -0
- package/dist/vendor/codali/runtime/InteractionRouter.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/InteractionRouter.js +134 -0
- package/dist/vendor/codali/runtime/PreparedDocdex.d.ts +4 -0
- package/dist/vendor/codali/runtime/PreparedDocdex.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/PreparedDocdex.js +55 -0
- package/dist/vendor/codali/runtime/PreparedMemory.d.ts +3 -0
- package/dist/vendor/codali/runtime/PreparedMemory.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/PreparedMemory.js +30 -0
- package/dist/vendor/codali/runtime/ReviewContract.d.ts +35 -0
- package/dist/vendor/codali/runtime/ReviewContract.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/ReviewContract.js +132 -0
- package/dist/vendor/codali/runtime/ReviewCoordinator.d.ts +41 -0
- package/dist/vendor/codali/runtime/ReviewCoordinator.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/ReviewCoordinator.js +132 -0
- package/dist/vendor/codali/runtime/ReviewSource.d.ts +3 -0
- package/dist/vendor/codali/runtime/ReviewSource.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/ReviewSource.js +17 -1
- package/dist/vendor/codali/runtime/Runner.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/Runner.js +6 -1
- package/dist/vendor/codali/runtime/SessionController.d.ts +51 -1
- package/dist/vendor/codali/runtime/SessionController.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/SessionController.js +1146 -112
- package/dist/vendor/codali/runtime/TaskReview.d.ts +25 -0
- package/dist/vendor/codali/runtime/TaskReview.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/TaskReview.js +109 -0
- package/dist/vendor/codali/runtime/TaskReviewContext.d.ts +37 -0
- package/dist/vendor/codali/runtime/TaskReviewContext.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/TaskReviewContext.js +18 -2
- package/dist/vendor/codali/runtime/UsageReconciliation.d.ts +28 -0
- package/dist/vendor/codali/runtime/UsageReconciliation.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/UsageReconciliation.js +68 -0
- package/dist/vendor/codali/runtime/VerificationCommand.d.ts +2 -0
- package/dist/vendor/codali/runtime/VerificationCommand.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/VerificationCommand.js +28 -0
- package/dist/vendor/codali/runtime/VerificationReceiptSelection.d.ts +15 -0
- package/dist/vendor/codali/runtime/VerificationReceiptSelection.d.ts.map +1 -0
- package/dist/vendor/codali/runtime/VerificationReceiptSelection.js +30 -0
- package/dist/vendor/codali/session/AtomicState.d.ts.map +1 -1
- package/dist/vendor/codali/session/AtomicState.js +15 -1
- package/dist/vendor/codali/session/InstructionLoader.d.ts +5 -1
- package/dist/vendor/codali/session/InstructionLoader.d.ts.map +1 -1
- package/dist/vendor/codali/session/InstructionLoader.js +65 -19
- package/dist/vendor/codali/session/SessionStoragePath.d.ts.map +1 -1
- package/dist/vendor/codali/session/SessionStoragePath.js +28 -16
- package/dist/vendor/codali/session/SessionStore.d.ts +5 -1
- package/dist/vendor/codali/session/SessionStore.d.ts.map +1 -1
- package/dist/vendor/codali/session/SessionStore.js +11 -2
- package/dist/vendor/codali/session/SkillCatalog.d.ts +33 -0
- package/dist/vendor/codali/session/SkillCatalog.d.ts.map +1 -0
- package/dist/vendor/codali/session/SkillCatalog.js +194 -0
- package/dist/vendor/codali/session/WorkState.d.ts +9 -0
- package/dist/vendor/codali/session/WorkState.d.ts.map +1 -1
- package/dist/vendor/codali/session/WorkState.js +32 -0
- package/dist/vendor/codali/session/WorkTypes.d.ts +8 -0
- package/dist/vendor/codali/session/WorkTypes.d.ts.map +1 -1
- package/dist/vendor/codali/tools/SemanticToolRetrieval.d.ts +19 -0
- package/dist/vendor/codali/tools/SemanticToolRetrieval.d.ts.map +1 -0
- package/dist/vendor/codali/tools/SemanticToolRetrieval.js +52 -0
- package/dist/vendor/codali/tools/ToolRetrieval.d.ts +7 -0
- package/dist/vendor/codali/tools/ToolRetrieval.d.ts.map +1 -0
- package/dist/vendor/codali/tools/ToolRetrieval.js +25 -0
- package/dist/vendor/codali/tools/browser/BrowserTool.d.ts +9 -0
- package/dist/vendor/codali/tools/browser/BrowserTool.d.ts.map +1 -0
- package/dist/vendor/codali/tools/browser/BrowserTool.js +152 -0
- package/dist/vendor/codali/tools/browser/BrowserWorker.d.ts +2 -0
- package/dist/vendor/codali/tools/browser/BrowserWorker.d.ts.map +1 -0
- package/dist/vendor/codali/tools/browser/BrowserWorker.js +51 -0
- package/dist/vendor/codali/tools/calculation/CalculatorTool.d.ts +5 -0
- package/dist/vendor/codali/tools/calculation/CalculatorTool.d.ts.map +1 -0
- package/dist/vendor/codali/tools/calculation/CalculatorTool.js +137 -0
- package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.d.ts +39 -0
- package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.d.ts.map +1 -0
- package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.js +98 -0
- package/dist/vendor/codali/tools/deterministic/DeterministicTools.d.ts +8 -0
- package/dist/vendor/codali/tools/deterministic/DeterministicTools.d.ts.map +1 -0
- package/dist/vendor/codali/tools/deterministic/DeterministicTools.js +86 -0
- package/dist/vendor/codali/tools/deterministic/node-worker.cjs +38 -0
- package/dist/vendor/codali/tools/deterministic/python-worker.py +222 -0
- package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.d.ts +4 -0
- package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.d.ts.map +1 -0
- package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.js +58 -0
- package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts +2 -0
- package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts.map +1 -1
- package/dist/vendor/codali/tools/docdex/DocdexTools.js +72 -105
- package/dist/vendor/codali/tools/documents/DocumentRuntime.d.ts +12 -0
- package/dist/vendor/codali/tools/documents/DocumentRuntime.d.ts.map +1 -0
- package/dist/vendor/codali/tools/documents/DocumentRuntime.js +59 -0
- package/dist/vendor/codali/tools/documents/DocumentTools.d.ts +19 -0
- package/dist/vendor/codali/tools/documents/DocumentTools.d.ts.map +1 -0
- package/dist/vendor/codali/tools/documents/DocumentTools.js +150 -0
- package/dist/vendor/codali/tools/documents/worker.py +267 -0
- package/dist/vendor/codali/tools/entities/AdesTool.d.ts +7 -0
- package/dist/vendor/codali/tools/entities/AdesTool.d.ts.map +1 -0
- package/dist/vendor/codali/tools/entities/AdesTool.js +59 -0
- package/dist/vendor/codali/tools/research/TnlTool.d.ts +22 -0
- package/dist/vendor/codali/tools/research/TnlTool.d.ts.map +1 -0
- package/dist/vendor/codali/tools/research/TnlTool.js +246 -0
- package/dist/vendor/codali/tools/shell/AsyncProcess.d.ts +3 -0
- package/dist/vendor/codali/tools/shell/AsyncProcess.d.ts.map +1 -1
- package/dist/vendor/codali/tools/shell/AsyncProcess.js +1 -1
- package/dist/vendor/codali/tools/shell/HostToolchain.d.ts.map +1 -1
- package/dist/vendor/codali/tools/shell/HostToolchain.js +18 -4
- package/dist/vendor/codali/tools/shell/IsolatedExecutor.d.ts +3 -2
- package/dist/vendor/codali/tools/shell/IsolatedExecutor.d.ts.map +1 -1
- package/dist/vendor/codali/tools/shell/IsolatedExecutor.js +39 -5
- package/dist/vendor/codali/tools/system/TimeTool.d.ts +4 -0
- package/dist/vendor/codali/tools/system/TimeTool.d.ts.map +1 -0
- package/dist/vendor/codali/tools/system/TimeTool.js +22 -0
- package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.d.ts +47 -0
- package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.d.ts.map +1 -0
- package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.js +71 -0
- package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.d.ts +2 -0
- package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.d.ts.map +1 -0
- package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.js +91 -0
- package/dist/vendor/codali/tools/verification/VitestTool.d.ts +3 -0
- package/dist/vendor/codali/tools/verification/VitestTool.d.ts.map +1 -0
- package/dist/vendor/codali/tools/verification/VitestTool.js +128 -0
- package/dist/vendor/config/AGENTS.md +11 -0
- package/dist/vendor/config/deterministic/install-python.mjs +16 -0
- package/dist/vendor/config/deterministic/node-worker.mjs +77 -0
- package/dist/vendor/config/deterministic/python-worker.py +222 -0
- package/dist/vendor/config/deterministic/requirements.txt +6 -0
- package/dist/vendor/config/docdex-runtime.json +21 -0
- package/dist/vendor/config/docdex-tools-0.2.99.json +3977 -0
- package/dist/vendor/config/documents/install-python.mjs +16 -0
- package/dist/vendor/config/documents/requirements.txt +10 -0
- package/dist/vendor/config/documents/worker.py +267 -0
- package/dist/vendor/config/skills/planning/SKILL.md +13 -0
- package/package.json +15 -5
- package/scripts/media_gpu_lock.py +2 -2
- package/scripts/native_load_guard.py +257 -0
|
@@ -81,9 +81,9 @@ export const readTerminalCredential = async (fromStdin) => {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
process.stderr.write("mSwarm API key: ");
|
|
85
84
|
process.stdin.setRawMode(true);
|
|
86
|
-
process.stdin.resume();
|
|
87
85
|
process.stdin.on("data", onData);
|
|
86
|
+
process.stdin.resume();
|
|
87
|
+
process.stderr.write("mSwarm API key: ");
|
|
88
88
|
});
|
|
89
89
|
};
|
|
@@ -9,15 +9,28 @@ export declare class TerminalInput extends Transform {
|
|
|
9
9
|
private pasted;
|
|
10
10
|
private bytes;
|
|
11
11
|
private overflow;
|
|
12
|
+
private escapeTimer?;
|
|
13
|
+
private escapeNotified;
|
|
14
|
+
private mousePending;
|
|
12
15
|
constructor(options: {
|
|
13
16
|
onPaste: (text: string) => void;
|
|
14
17
|
onRejected: (reason: string) => void;
|
|
15
18
|
maxPasteBytes?: number;
|
|
19
|
+
onEscape?: () => void;
|
|
20
|
+
onWheel?: (direction: -1 | 1) => void;
|
|
21
|
+
onMouse?: (event: {
|
|
22
|
+
button: number;
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
release: boolean;
|
|
26
|
+
}) => void;
|
|
16
27
|
});
|
|
17
28
|
private append;
|
|
29
|
+
private forward;
|
|
18
30
|
private consume;
|
|
19
31
|
_transform(chunk: Buffer, _encoding: BufferEncoding, callback: TransformCallback): void;
|
|
20
32
|
_flush(callback: TransformCallback): void;
|
|
33
|
+
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
|
|
21
34
|
}
|
|
22
35
|
/** readline exposes the current editable line and cursor; refresh preserves multiline content. */
|
|
23
36
|
export declare const insertTerminalPaste: (readline: Interface, text: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerminalInput.d.ts","sourceRoot":"","sources":["../../src/cli/TerminalInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAS/C,qFAAqF;AACrF,qBAAa,aAAc,SAAQ,SAAS;
|
|
1
|
+
{"version":3,"file":"TerminalInput.d.ts","sourceRoot":"","sources":["../../src/cli/TerminalInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAS/C,qFAAqF;AACrF,qBAAa,aAAc,SAAQ,SAAS;IAU9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IATpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAAC,CAAiB;IACrC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAM;gBACG,OAAO,EAAE;QAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,OAAO,CAAA;SAAE,KAAK,IAAI,CAAA;KAAE;IAC5R,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,OAAO;IAoBf,OAAO,CAAC,OAAO;IAmBN,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAevF,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAQzC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI;CACvF;AAED,kGAAkG;AAClG,eAAO,MAAM,mBAAmB,GAAI,UAAU,SAAS,EAAE,MAAM,MAAM,KAAG,IAOvE,CAAC"}
|
|
@@ -19,6 +19,8 @@ export class TerminalInput extends Transform {
|
|
|
19
19
|
this.pasted = "";
|
|
20
20
|
this.bytes = 0;
|
|
21
21
|
this.overflow = false;
|
|
22
|
+
this.escapeNotified = false;
|
|
23
|
+
this.mousePending = "";
|
|
22
24
|
}
|
|
23
25
|
append(text) {
|
|
24
26
|
this.bytes += Buffer.byteLength(text);
|
|
@@ -29,6 +31,38 @@ export class TerminalInput extends Transform {
|
|
|
29
31
|
else if (!this.overflow)
|
|
30
32
|
this.pasted += text;
|
|
31
33
|
}
|
|
34
|
+
forward(text) {
|
|
35
|
+
if (this.options.onWheel || this.options.onMouse) {
|
|
36
|
+
text = this.mousePending + text;
|
|
37
|
+
this.mousePending = "";
|
|
38
|
+
text = text.replace(/\x1b\[<(\d+);(\d+);(\d+)([Mm])/g, (_match, code, _x, _y, end) => {
|
|
39
|
+
const button = Number(code);
|
|
40
|
+
if (end === "M" && (button & 64) && (button & 3) < 2)
|
|
41
|
+
this.options.onWheel?.((button & 1) ? 1 : -1);
|
|
42
|
+
else if (!(button & 64))
|
|
43
|
+
this.options.onMouse?.({ button, x: Number(_x) - 1, y: Number(_y) - 1, release: end === "m" });
|
|
44
|
+
return "";
|
|
45
|
+
});
|
|
46
|
+
const partial = /\x1b\[<[0-9;]{0,40}$/.exec(text);
|
|
47
|
+
if (partial) {
|
|
48
|
+
this.mousePending = partial[0];
|
|
49
|
+
text = text.slice(0, partial.index);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// A standalone Escape can share a read with the next paste marker. Notify
|
|
53
|
+
// it before delivering that paste instead of leaving readline's escape
|
|
54
|
+
// timeout pending while the paste callback observes the old modal state.
|
|
55
|
+
let escapes = 0;
|
|
56
|
+
if (this.options.onEscape)
|
|
57
|
+
while (text.endsWith("\u001b")) {
|
|
58
|
+
text = text.slice(0, -1);
|
|
59
|
+
escapes++;
|
|
60
|
+
}
|
|
61
|
+
if (text)
|
|
62
|
+
this.push(text);
|
|
63
|
+
for (let index = 0; index < escapes; index++)
|
|
64
|
+
this.options.onEscape();
|
|
65
|
+
}
|
|
32
66
|
consume(text) {
|
|
33
67
|
this.pending += text;
|
|
34
68
|
while (this.pending) {
|
|
@@ -39,8 +73,8 @@ export class TerminalInput extends Transform {
|
|
|
39
73
|
const ready = this.pending.slice(0, this.pending.length - keep);
|
|
40
74
|
if (this.pasting)
|
|
41
75
|
this.append(ready);
|
|
42
|
-
else
|
|
43
|
-
this.
|
|
76
|
+
else
|
|
77
|
+
this.forward(ready);
|
|
44
78
|
this.pending = keep ? this.pending.slice(-keep) : "";
|
|
45
79
|
return;
|
|
46
80
|
}
|
|
@@ -58,15 +92,25 @@ export class TerminalInput extends Transform {
|
|
|
58
92
|
this.overflow = false;
|
|
59
93
|
}
|
|
60
94
|
else {
|
|
61
|
-
|
|
62
|
-
this.push(ready);
|
|
95
|
+
this.forward(ready);
|
|
63
96
|
this.pasting = true;
|
|
64
97
|
}
|
|
65
98
|
}
|
|
66
99
|
}
|
|
67
100
|
_transform(chunk, _encoding, callback) {
|
|
68
101
|
try {
|
|
69
|
-
|
|
102
|
+
if (this.escapeTimer)
|
|
103
|
+
clearTimeout(this.escapeTimer);
|
|
104
|
+
const text = this.decoder.write(chunk);
|
|
105
|
+
// Notify a standalone Escape promptly, but retain its prefix so a delayed
|
|
106
|
+
// bracketed-paste marker still cannot turn pasted newlines into commands.
|
|
107
|
+
if (this.escapeNotified && this.pending === "\u001b" && !text.startsWith("["))
|
|
108
|
+
this.pending = "";
|
|
109
|
+
this.escapeNotified = false;
|
|
110
|
+
this.consume(text);
|
|
111
|
+
if (!this.pasting && this.pending === "\u001b" && this.options.onEscape) {
|
|
112
|
+
this.escapeTimer = setTimeout(() => { this.escapeNotified = true; this.options.onEscape?.(); }, 100);
|
|
113
|
+
}
|
|
70
114
|
callback();
|
|
71
115
|
}
|
|
72
116
|
catch (error) {
|
|
@@ -75,17 +119,21 @@ export class TerminalInput extends Transform {
|
|
|
75
119
|
}
|
|
76
120
|
_flush(callback) {
|
|
77
121
|
try {
|
|
122
|
+
if (this.escapeTimer)
|
|
123
|
+
clearTimeout(this.escapeTimer);
|
|
78
124
|
this.consume(this.decoder.end());
|
|
79
125
|
if (this.pasting)
|
|
80
126
|
this.options.onRejected("Incomplete paste discarded");
|
|
81
|
-
else if (this.pending)
|
|
82
|
-
this.
|
|
127
|
+
else if (this.pending && !(this.pending === "\u001b" && this.escapeNotified))
|
|
128
|
+
this.forward(this.pending);
|
|
83
129
|
callback();
|
|
84
130
|
}
|
|
85
131
|
catch (error) {
|
|
86
132
|
callback(error);
|
|
87
133
|
}
|
|
88
134
|
}
|
|
135
|
+
_destroy(error, callback) { if (this.escapeTimer)
|
|
136
|
+
clearTimeout(this.escapeTimer); callback(error); }
|
|
89
137
|
}
|
|
90
138
|
/** readline exposes the current editable line and cursor; refresh preserves multiline content. */
|
|
91
139
|
export const insertTerminalPaste = (readline, text) => {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ModelOperation, type ResolvedOrchestrationConfig } from "../config/OrchestrationConfig.js";
|
|
2
|
+
export declare const terminalModelOperation: (binding: string) => ModelOperation;
|
|
3
|
+
export declare const proposeTerminalModel: (resolved: ResolvedOrchestrationConfig, binding: string, modelId: string) => ResolvedOrchestrationConfig;
|
|
4
|
+
/** Preserve concurrent edits; the caller must validate live entitlement before saving. */
|
|
5
|
+
export declare const saveTerminalModel: (previous: ResolvedOrchestrationConfig, next: ResolvedOrchestrationConfig, signal: AbortSignal) => Promise<void>;
|
|
6
|
+
//# sourceMappingURL=TerminalModels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalModels.d.ts","sourceRoot":"","sources":["../../src/cli/TerminalModels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqH,KAAK,cAAc,EAAE,KAAK,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG5N,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,KAAG,cAMxD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,UAAU,2BAA2B,EAAE,SAAS,MAAM,EAAE,SAAS,MAAM,KAAG,2BAY9G,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,iBAAiB,GAAU,UAAU,2BAA2B,EAAE,MAAM,2BAA2B,EAAE,QAAQ,WAAW,KAAG,OAAO,CAAC,IAAI,CAWnJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { configuredEmbeddingSpace, loadOrchestrationConfig, orchestrationHash, resolveBinding, validateOrchestrationConfig } from "../config/OrchestrationConfig.js";
|
|
2
|
+
import { atomicWriteJson, withStateLock } from "../session/AtomicState.js";
|
|
3
|
+
export const terminalModelOperation = (binding) => {
|
|
4
|
+
if (binding === "embedding")
|
|
5
|
+
return "embeddings";
|
|
6
|
+
if (binding === "image")
|
|
7
|
+
return "images.generations";
|
|
8
|
+
if (binding === "audio")
|
|
9
|
+
return "audio.generations";
|
|
10
|
+
if (binding === "video")
|
|
11
|
+
return "videos.generations";
|
|
12
|
+
return "chat.completions";
|
|
13
|
+
};
|
|
14
|
+
export const proposeTerminalModel = (resolved, binding, modelId) => {
|
|
15
|
+
const config = structuredClone(resolved.config);
|
|
16
|
+
if (!Object.prototype.hasOwnProperty.call(config.bindings, binding))
|
|
17
|
+
throw new Error(`Unknown configured binding: ${binding}`);
|
|
18
|
+
if (!Object.prototype.hasOwnProperty.call(config.models, modelId))
|
|
19
|
+
throw new Error(`Unknown configured model: ${modelId}`);
|
|
20
|
+
const previousSpace = config.bindings.embedding && config.bindings.embedding.enabled !== false ? configuredEmbeddingSpace(config) : undefined;
|
|
21
|
+
const old = config.bindings[binding];
|
|
22
|
+
config.bindings[binding] = { enabled: true, candidates: [modelId],
|
|
23
|
+
...((binding === "embedding" ? previousSpace?.label ?? old.embeddingSpace : old.embeddingSpace) ? { embeddingSpace: binding === "embedding" ? previousSpace?.label ?? old.embeddingSpace : old.embeddingSpace } : {}) };
|
|
24
|
+
validateOrchestrationConfig(config);
|
|
25
|
+
resolveBinding(config, binding, terminalModelOperation(binding));
|
|
26
|
+
if (previousSpace && configuredEmbeddingSpace(config).id !== previousSpace.id)
|
|
27
|
+
throw new Error("Embedding space would change. Use a new configuration and a fresh session to rebuild a separate index; the current index cannot be reused.");
|
|
28
|
+
return { config, source: resolved.source, hash: orchestrationHash(config) };
|
|
29
|
+
};
|
|
30
|
+
/** Preserve concurrent edits; the caller must validate live entitlement before saving. */
|
|
31
|
+
export const saveTerminalModel = async (previous, next, signal) => {
|
|
32
|
+
if (next.source !== previous.source)
|
|
33
|
+
throw new Error("Model selection must retain the shared configuration source");
|
|
34
|
+
validateOrchestrationConfig(next.config);
|
|
35
|
+
if (next.hash !== orchestrationHash(next.config))
|
|
36
|
+
throw new Error("Model configuration hash mismatch");
|
|
37
|
+
signal.throwIfAborted();
|
|
38
|
+
await withStateLock(previous.source, async () => {
|
|
39
|
+
const current = await loadOrchestrationConfig(previous.source);
|
|
40
|
+
if (current.hash !== previous.hash)
|
|
41
|
+
throw new Error("Configuration changed on disk; use /config reload and review the selection again");
|
|
42
|
+
signal.throwIfAborted();
|
|
43
|
+
await atomicWriteJson(previous.source, next.config);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { WorkState } from "../session/WorkTypes.js";
|
|
2
|
+
export declare const inspectPlanDiff: (state: WorkState, from?: number, to?: number) => {
|
|
3
|
+
fromRevision: number;
|
|
4
|
+
toRevision: number;
|
|
5
|
+
tasks: {
|
|
6
|
+
id: string;
|
|
7
|
+
before?: {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
phaseId: string | undefined;
|
|
11
|
+
requirementIds: string[];
|
|
12
|
+
dependsOn: string[];
|
|
13
|
+
allowedPaths: string[];
|
|
14
|
+
} | undefined;
|
|
15
|
+
after?: {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
phaseId: string | undefined;
|
|
19
|
+
requirementIds: string[];
|
|
20
|
+
dependsOn: string[];
|
|
21
|
+
allowedPaths: string[];
|
|
22
|
+
} | undefined;
|
|
23
|
+
}[];
|
|
24
|
+
phases: {
|
|
25
|
+
id: string;
|
|
26
|
+
before?: {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
dependsOn: string[];
|
|
30
|
+
exitRequirementIds: string[];
|
|
31
|
+
} | undefined;
|
|
32
|
+
after?: {
|
|
33
|
+
id: string;
|
|
34
|
+
title: string;
|
|
35
|
+
dependsOn: string[];
|
|
36
|
+
exitRequirementIds: string[];
|
|
37
|
+
} | undefined;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=TerminalPlan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalPlan.d.ts","sourceRoot":"","sources":["../../src/cli/TerminalPlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAuB,MAAM,yBAAyB,CAAC;AAiB9E,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,EAAE,OAAO,MAAM,EAAE,KAAK,MAAM;;;;YARS,MAAM;;;;;;;;;;;;;;;;;;;YAAN,MAAM;;;;;;;;;;;;;;CA0B1F,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const taskContract = (task) => ({
|
|
2
|
+
id: task.id, title: task.title, phaseId: task.phaseId,
|
|
3
|
+
requirementIds: [...task.requirementIds].sort(), dependsOn: [...task.dependsOn].sort(), allowedPaths: [...task.allowedPaths].sort(),
|
|
4
|
+
});
|
|
5
|
+
const phaseContract = (phase) => ({
|
|
6
|
+
id: phase.id, title: phase.title, dependsOn: [...phase.dependsOn].sort(), exitRequirementIds: [...phase.exitRequirementIds].sort(),
|
|
7
|
+
});
|
|
8
|
+
const differences = (before, after) => {
|
|
9
|
+
const old = new Map(before.map(item => [item.id, item]));
|
|
10
|
+
const next = new Map(after.map(item => [item.id, item]));
|
|
11
|
+
return [...new Set([...old.keys(), ...next.keys()])].sort()
|
|
12
|
+
.filter(id => JSON.stringify(old.get(id)) !== JSON.stringify(next.get(id)))
|
|
13
|
+
.map(id => ({ id, before: old.get(id), after: next.get(id) }));
|
|
14
|
+
};
|
|
15
|
+
export const inspectPlanDiff = (state, from, to) => {
|
|
16
|
+
const current = state.planRevision ?? 1;
|
|
17
|
+
const history = state.planHistory ?? [];
|
|
18
|
+
const toRevision = to ?? current;
|
|
19
|
+
const previous = history.filter(item => item.revision < toRevision).reduce((latest, item) => Math.max(latest, item.revision), 0);
|
|
20
|
+
const fromRevision = from ?? (previous || toRevision);
|
|
21
|
+
const snapshot = (revision) => {
|
|
22
|
+
if (!Number.isSafeInteger(revision) || revision < 1)
|
|
23
|
+
throw new Error("Plan revisions must be positive integers");
|
|
24
|
+
if (revision === current)
|
|
25
|
+
return { tasks: state.tasks, phases: state.phases ?? [] };
|
|
26
|
+
const saved = history.find(item => item.revision === revision);
|
|
27
|
+
if (!saved)
|
|
28
|
+
throw new Error(`Unknown plan revision ${revision}`);
|
|
29
|
+
return saved;
|
|
30
|
+
};
|
|
31
|
+
const before = snapshot(fromRevision);
|
|
32
|
+
const after = snapshot(toRevision);
|
|
33
|
+
return { fromRevision, toRevision,
|
|
34
|
+
tasks: differences(before.tasks.map(taskContract), after.tasks.map(taskContract)),
|
|
35
|
+
phases: differences(before.phases.map(phaseContract), after.phases.map(phaseContract)),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolsCommand.d.ts","sourceRoot":"","sources":["../../src/cli/ToolsCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolsCommand.d.ts","sourceRoot":"","sources":["../../src/cli/ToolsCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAmCxD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,KAAG,YAqC/C,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACnE,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,KAAK,YAAY,CAAC;IACjF,SAAS,CAAC,EAAE,OAAO,cAAc,CAAC;IAClC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAkBD,eAAO,MAAM,QAAQ,GACnB,MAAM,MAAM,EAAE,EACd,OAAM,iBAAsB,KAC3B,OAAO,CAAC,MAAM,CA6JhB,CAAC;AAEF,eAAO,MAAM,YAAY;cACP,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAIzC,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { ToolRegistry } from "../tools/ToolRegistry.js";
|
|
|
8
8
|
import { createDocdexTools } from "../tools/docdex/DocdexTools.js";
|
|
9
9
|
import { sanitizeArgs } from "../gateway/GatewayTracer.js";
|
|
10
10
|
import { inspectToolSurface } from "../gateway/ToolSurface.js";
|
|
11
|
+
import { runDeterministicRuntimeCommand } from "../tools/deterministic/DeterministicRuntime.js";
|
|
11
12
|
/**
|
|
12
13
|
* `codali tools` — inspect what an orchestration run can actually reach.
|
|
13
14
|
*
|
|
@@ -15,13 +16,17 @@ import { inspectToolSurface } from "../gateway/ToolSurface.js";
|
|
|
15
16
|
* exposes is to ask a question and read the trace, which conflates connector
|
|
16
17
|
* problems with planning problems.
|
|
17
18
|
*/
|
|
18
|
-
const HELP = `Usage: codali tools <list|describe|call|health> [options]
|
|
19
|
+
const HELP = `Usage: codali tools <list|describe|call|health|install|check> [options]
|
|
19
20
|
|
|
20
21
|
Commands:
|
|
21
22
|
list List every tool available to a run, grouped by capability
|
|
22
23
|
describe <name> Show one tool's description and argument schema
|
|
23
24
|
call <name> Invoke a tool directly (read-only connectors)
|
|
24
25
|
health Show MCP server connection status
|
|
26
|
+
install Install pinned host Python tools, then run their checks
|
|
27
|
+
check Check deterministic tools without inference (--documents: document tools)
|
|
28
|
+
|
|
29
|
+
Host install/check commands accept only --json; they do not use tenant context.
|
|
25
30
|
|
|
26
31
|
Options:
|
|
27
32
|
--workspace-root <path> Repository to resolve config against (default: cwd)
|
|
@@ -88,6 +93,8 @@ export const runTools = async (argv, deps = {}) => {
|
|
|
88
93
|
write(HELP);
|
|
89
94
|
return 0;
|
|
90
95
|
}
|
|
96
|
+
if (["install", "check"].includes(argv[0]))
|
|
97
|
+
return runDeterministicRuntimeCommand(argv, write);
|
|
91
98
|
const options = parseToolsArgs(argv);
|
|
92
99
|
// A host-supplied context answers the question a product actually has: not
|
|
93
100
|
// "what can this machine do" but "what would this tenant's run get".
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const graphemes: (text: string) => string[];
|
|
2
|
+
export declare const cells: (text: string) => number;
|
|
3
|
+
export declare const fitCells: (text: string, width: number, ellipsis?: boolean) => string;
|
|
4
|
+
export declare const wrapCells: (text: string, width: number) => string[];
|
|
5
|
+
export declare const padCells: (text: string, width: number) => string;
|
|
6
|
+
//# sourceMappingURL=TerminalCells.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalCells.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalCells.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAAM,EAA2G,CAAC;AAC3J,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,KAAG,MAAuE,CAAC;AAG7G,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,kBAAgB,KAAG,MAYxE,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAAM,EAY7D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAGtD,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference lib="es2022.intl" />
|
|
2
|
+
import stringWidth from "string-width";
|
|
3
|
+
const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
4
|
+
export const graphemes = (text) => /^[\x20-\x7e]*$/.test(text) ? text.split("") : [...segmenter.segment(text)].map(part => part.segment);
|
|
5
|
+
export const cells = (text) => /^[\x20-\x7e]*$/.test(text) ? text.length : stringWidth(text);
|
|
6
|
+
const finiteWidth = (width) => Number.isFinite(width) ? Math.max(0, Math.floor(width)) : 0;
|
|
7
|
+
export const fitCells = (text, width, ellipsis = false) => {
|
|
8
|
+
const limit = finiteWidth(width);
|
|
9
|
+
if (!limit)
|
|
10
|
+
return "";
|
|
11
|
+
if (cells(text) <= limit)
|
|
12
|
+
return text;
|
|
13
|
+
const suffix = ellipsis ? "…" : "";
|
|
14
|
+
let result = "", used = 0;
|
|
15
|
+
for (const part of graphemes(text)) {
|
|
16
|
+
const size = cells(part);
|
|
17
|
+
if (used + size > limit - cells(suffix))
|
|
18
|
+
break;
|
|
19
|
+
result += part;
|
|
20
|
+
used += size;
|
|
21
|
+
}
|
|
22
|
+
return result + suffix;
|
|
23
|
+
};
|
|
24
|
+
export const wrapCells = (text, width) => {
|
|
25
|
+
const limit = Math.max(1, finiteWidth(width));
|
|
26
|
+
return text.split("\n").flatMap(line => {
|
|
27
|
+
const rows = [];
|
|
28
|
+
let current = "", used = 0;
|
|
29
|
+
for (const original of graphemes(line)) {
|
|
30
|
+
const part = cells(original) > limit ? "?" : original;
|
|
31
|
+
const size = cells(part);
|
|
32
|
+
if (used + size > limit) {
|
|
33
|
+
rows.push(current);
|
|
34
|
+
current = "";
|
|
35
|
+
used = 0;
|
|
36
|
+
}
|
|
37
|
+
current += part;
|
|
38
|
+
used += size;
|
|
39
|
+
}
|
|
40
|
+
rows.push(current);
|
|
41
|
+
return rows;
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
export const padCells = (text, width) => {
|
|
45
|
+
const clipped = fitCells(text, width);
|
|
46
|
+
return clipped + " ".repeat(Math.max(0, finiteWidth(width) - cells(clipped)));
|
|
47
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Cursor offsets are UTF-16 boundaries of complete graphemes, never terminal cells. */
|
|
2
|
+
export declare class TerminalEditor {
|
|
3
|
+
history: string[];
|
|
4
|
+
private readonly limit;
|
|
5
|
+
text: string;
|
|
6
|
+
cursor: number;
|
|
7
|
+
private historyIndex;
|
|
8
|
+
private draft;
|
|
9
|
+
constructor(history?: string[], limit?: number);
|
|
10
|
+
set(text: string): void;
|
|
11
|
+
insert(text: string): boolean;
|
|
12
|
+
move(direction: -1 | 1): void;
|
|
13
|
+
delete(backward: boolean): void;
|
|
14
|
+
home(): void;
|
|
15
|
+
end(): void;
|
|
16
|
+
vertical(direction: -1 | 1): boolean;
|
|
17
|
+
clear(): void;
|
|
18
|
+
killWord(): void;
|
|
19
|
+
previous(direction: -1 | 1): void;
|
|
20
|
+
submit(): string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=TerminalEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalEditor.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalEditor.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,qBAAa,cAAc;IAKN,OAAO,EAAE,MAAM,EAAE;IAAO,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJjE,IAAI,SAAM;IACV,MAAM,SAAK;IACX,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,KAAK,CAAM;gBACA,OAAO,GAAE,MAAM,EAAO,EAAmB,KAAK,SAAS;IAC1E,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IACvB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK7B,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI;IAI7B,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAK/B,IAAI,IAAI,IAAI;IACZ,GAAG,IAAI,IAAI;IACX,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO;IAUpC,KAAK,IAAI,IAAI;IACb,QAAQ,IAAI,IAAI;IAKhB,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI;IAKjC,MAAM,IAAI,MAAM;CAKjB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { cells, graphemes } from "./TerminalCells.js";
|
|
2
|
+
/** Cursor offsets are UTF-16 boundaries of complete graphemes, never terminal cells. */
|
|
3
|
+
export class TerminalEditor {
|
|
4
|
+
constructor(history = [], limit = 262144) {
|
|
5
|
+
this.history = history;
|
|
6
|
+
this.limit = limit;
|
|
7
|
+
this.text = "";
|
|
8
|
+
this.cursor = 0;
|
|
9
|
+
this.historyIndex = -1;
|
|
10
|
+
this.draft = "";
|
|
11
|
+
}
|
|
12
|
+
set(text) { this.text = text; this.cursor = text.length; this.historyIndex = -1; }
|
|
13
|
+
insert(text) {
|
|
14
|
+
const next = this.text.slice(0, this.cursor) + text + this.text.slice(this.cursor);
|
|
15
|
+
if (Buffer.byteLength(next) > this.limit)
|
|
16
|
+
return false;
|
|
17
|
+
this.text = next;
|
|
18
|
+
this.cursor += text.length;
|
|
19
|
+
this.historyIndex = -1;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
move(direction) {
|
|
23
|
+
if (direction < 0)
|
|
24
|
+
this.cursor -= graphemes(this.text.slice(0, this.cursor)).at(-1)?.length ?? 0;
|
|
25
|
+
else
|
|
26
|
+
this.cursor += graphemes(this.text.slice(this.cursor))[0]?.length ?? 0;
|
|
27
|
+
}
|
|
28
|
+
delete(backward) {
|
|
29
|
+
const old = this.cursor;
|
|
30
|
+
this.move(backward ? -1 : 1);
|
|
31
|
+
const start = Math.min(old, this.cursor), end = Math.max(old, this.cursor);
|
|
32
|
+
this.text = this.text.slice(0, start) + this.text.slice(end);
|
|
33
|
+
this.cursor = start;
|
|
34
|
+
}
|
|
35
|
+
home() { this.cursor = this.cursor === 0 ? 0 : this.text.lastIndexOf("\n", this.cursor - 1) + 1; }
|
|
36
|
+
end() { const next = this.text.indexOf("\n", this.cursor); this.cursor = next < 0 ? this.text.length : next; }
|
|
37
|
+
vertical(direction) {
|
|
38
|
+
const start = this.cursor === 0 ? 0 : this.text.lastIndexOf("\n", this.cursor - 1) + 1;
|
|
39
|
+
const column = cells(this.text.slice(start, this.cursor));
|
|
40
|
+
let target, end;
|
|
41
|
+
if (direction < 0) {
|
|
42
|
+
if (start === 0)
|
|
43
|
+
return false;
|
|
44
|
+
end = start - 1;
|
|
45
|
+
target = end === 0 ? 0 : this.text.lastIndexOf("\n", end - 1) + 1;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const next = this.text.indexOf("\n", this.cursor);
|
|
49
|
+
if (next < 0)
|
|
50
|
+
return false;
|
|
51
|
+
target = next + 1;
|
|
52
|
+
const following = this.text.indexOf("\n", target);
|
|
53
|
+
end = following < 0 ? this.text.length : following;
|
|
54
|
+
}
|
|
55
|
+
let width = 0;
|
|
56
|
+
this.cursor = target;
|
|
57
|
+
for (const part of graphemes(this.text.slice(target, end))) {
|
|
58
|
+
if (width + cells(part) > column)
|
|
59
|
+
break;
|
|
60
|
+
width += cells(part);
|
|
61
|
+
this.cursor += part.length;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
clear() { this.set(""); }
|
|
66
|
+
killWord() {
|
|
67
|
+
const before = this.text.slice(0, this.cursor);
|
|
68
|
+
const match = before.match(/(?:\s+|\S+\s*)$/u);
|
|
69
|
+
if (match) {
|
|
70
|
+
this.text = before.slice(0, -match[0].length) + this.text.slice(this.cursor);
|
|
71
|
+
this.cursor -= match[0].length;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
previous(direction) {
|
|
75
|
+
if (this.historyIndex < 0)
|
|
76
|
+
this.draft = this.text;
|
|
77
|
+
this.historyIndex = Math.max(-1, Math.min(this.history.length - 1, this.historyIndex - direction));
|
|
78
|
+
this.text = this.historyIndex < 0 ? this.draft : this.history[this.historyIndex];
|
|
79
|
+
this.cursor = this.text.length;
|
|
80
|
+
}
|
|
81
|
+
submit() {
|
|
82
|
+
const text = this.text;
|
|
83
|
+
if (text.trim())
|
|
84
|
+
this.history = [text, ...this.history.filter(item => item !== text)].slice(0, 500);
|
|
85
|
+
this.clear();
|
|
86
|
+
return text;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const terminalLogo: string[];
|
|
2
|
+
export declare const plainTerminalLogo: string[];
|
|
3
|
+
export declare const terminalLogoWidth: number;
|
|
4
|
+
export declare const compactTerminalLogo: string[];
|
|
5
|
+
export declare const renderCompactLogo: (color: boolean) => string[];
|
|
6
|
+
//# sourceMappingURL=TerminalLogo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalLogo.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalLogo.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY,UAAuD,CAAC;AACjF,eAAO,MAAM,iBAAiB,UAAqE,CAAC;AACpG,eAAO,MAAM,iBAAiB,QAA4C,CAAC;AAE3E,eAAO,MAAM,mBAAmB,UAA+D,CAAC;AAChG,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,MAAM,EAOxD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from "node:util";
|
|
2
|
+
import { cells } from "./TerminalCells.js";
|
|
3
|
+
// Trusted, user-supplied artwork. Decode only SGR color markers, never input data.
|
|
4
|
+
const artwork = `[0;37m [0;35m▄[0;95m▄▄▄▄▄▄[0;35m▄[0;37m [0;35m▄[0;37m [0;35m▄[0;95m▄[0;95;45m▄[0;37m [0;95m█▄[0;35m▄[0;37m [0m
|
|
5
|
+
[0;37m [0;35m▄[0;95;45m▄[0;95m██[0;95;47m▓▀▀▀[0;95m██[0;95;45m▓▄[0;95m▄[0;37m [0;35m▄[0;95;45m▄▓[0;95m████[0;95;45m▄[0;95m▄[0;35m▄[0;37m [0;35m▄[0;95m▄[0;95;45m▄[0;95m██[0;95;45m▄[0;35m▄[0;37m [0;95;45m░[0;95m████▌[0;37m [0;35m▐[0;95m███[0;95;45m▄[0;35m▄[0;37m [0;35m▄▄[0;95m▄[0;95;45m▄▄▓[0;37m [0m
|
|
6
|
+
[0;37m [0;35m▄[0;95;45m▄[0;95m███[0;95;47m▄[0;95m████[0;95;47m▓▄[0;95m██▀[0;37m [0;35m▄[0;95;45m▄[0;95m████[0;95;47m▄▓[0;95m████[0;35m█[0;37m [0;95m███[0;95;45m▒[0;95;47m▄▓[0;95m██[0;95;45m▄[0;35m▄[0;37m [0;95m█[0;95;45m▓[0;97;45m▄[0;97m█[0;97;45m▓[0;95m█▌[0;37m [0;35m▐[0;95m█[0;95;45m▄[0;95m███[0;37m [0;95m▐███[0;95;45m▄[0;95m█[0;37m [0m
|
|
7
|
+
[0;95m▐█[0;97;45m▄[0;97m█[0;97;45m▓[0;95m█▀[0;37m [0;95m▀▀█[0;37m [0;95;41m▒[0;95;45m▓[0;97m██[0;95;47m▓[0;95m▀[0;37m [0;95m▀█[0;97;45m▄[0;97m█[0;95m█[0;37m [0;95m█[0;97;45m▓[0;97m█[0;97;45m▄[0;95m█▀███[0;95;47m▓▓[0;95;45m▄▄[0;37m [0;95m▐█[0;97m█████[0;95;45m▓[0;95m▌[0;37m [0;95m▐█[0;97;45m▄[0;97m█[0;97;45m▓[0;95m█[0;35m▌[0;37m [0;95m▐█[0;97;45m▓[0;97m█[0;97;45m▄[0;95m█[0;37m [0m
|
|
8
|
+
[0;37m [0;97;47m▐[0;97m███[0;97;47m▓[0;37m [0;97;41m░[0;97;47m▓[0;97m███[0;37m▌ [0;97;47m▐[0;97m██[0;97;45m▓[0;37m▌[0;97;47m▐[0;97m████[0;37m [0;95;41m▀[0;95;47m▒▒[0;97;47m▒▒[0;95;41m▓[0;37m [0;31;47m░[0;97m███████[0;97;47m▌[0;37m [0;35m▐[0;97;47m▐[0;97m███[0;97;47m▓[0;35m▌[0;37m ▐[0;97;47m▓[0;97m███[0;97;47m▌[0;37m [0m
|
|
9
|
+
[0;37m▐[0;97m██[0;34m██[0;97m█[0;97;47m▌[0;37m ▐[0;97m████[0;97;47m▌[0;37m [0;97;47m▐[0;97m███[0;97;47m▌[0;37m▐[0;97m████[0;37m▌ [0;97;47m▐▓▓[0;97m█[0;97;41m▓[0;37m ▐[0;97m███[0;97;47m▓[0;37m [0;97m▀███[0;97;47m▌[0;37m ▐[0;97m██[0;34m██[0;97m█[0;97;47m▌[0;37m ▐[0;97m████[0;97;47m▌[0;37m▌[0m
|
|
10
|
+
[0;37m [0;92;47m▐[0;92m█[0;92;46m▄▄[0;97m██[0;97;47m▄[0;37m▄ [0;97;47m▐[0;97m███[0;97;47m▓[0;37m▄ [0;97m▐[0;97;47m▓[0;97m██[0;97;47m▌[0;37m [0;97;47m▐[0;97m███[0;97;47m▌[0;37m ▐[0;97m███[0;97;47m▌[0;37m [0;97;47m▐[0;97m██████████[0;37m▌ [0;92;47m▐[0;92m█[0;92;46m▄▄[0;97m██[0;97;47m▄[0;37m▄ [0;97;47m▐[0;97m███[0;97;47m▌[0;37m [0m
|
|
11
|
+
[0;37m ▀[0;97;47m▐[0;93m██[0;97m███[0;97;47m▓[0;97m████[0;97;43m▓░[0;33m█[0;37m [0;93m▀██[0;97m███[0;97;47m▓[0;97m██████[0;93m█[0;37m [0;97;47m▐[0;97m███[0;97;47m▄[0;97m▄▄▄[0;97;47m▄[0;97m███[0;97;47m▌[0;37m [0;93m▐█[0;97m██[0;93m██[0;97m█▀██[0;97;47m▓[0;97m██[0;37m▌ ▀[0;97;47m▐[0;93m██[0;97m███[0;97;47m▓[0;97m████[0;97;43m▓░[0;33m█[0;37m [0;93m██[0;97m██[0;93m█[0;37m [0m
|
|
12
|
+
[0;37m [0;93m▀▀▀[0;93;43m▀[0;93m██████[0;93;43m▓[0;37m [0;93m▀▀▀[0;93;43m▀[0;93m████[0;93;43m▀[0;93m▀[0;37m [0;93m▐[0;93;47m▓[0;93m███████[0;93;43m▀[0;93m▀▀[0;37m [0;93;43m▀▓[0;93m█[0;93;47m▓[0;37m [0;93m▐█[0;97m██[0;93m██[0;37m [0;93m▀▀▀[0;93;43m▀[0;93m██████[0;93;43m▓[0;37m [0;33m▐[0;93;43m▀[0;93m███[0;37m [0m
|
|
13
|
+
[0;37m [0;33m▀[0;93m▀▀▀[0;37m [0;93m█[0;93;43m▀[0;93m▀▀[0;33m▀[0;37m [0m`;
|
|
14
|
+
export const terminalLogo = artwork.replace(/\[[0-9;]+m/g, "\x1b$&").split("\n");
|
|
15
|
+
export const plainTerminalLogo = terminalLogo.map(line => stripVTControlCharacters(line).trimEnd());
|
|
16
|
+
export const terminalLogoWidth = Math.max(...plainTerminalLogo.map(cells));
|
|
17
|
+
export const compactTerminalLogo = ["┏┓ ┏┓ ┳┓ ┏┓ ┓ ∙", "┃ ┃┃ ┃┃ ┣┫ ┃ ┃", "┗┛ ┗┛ ┻┛ ┛┗ ┗┛ ┻"];
|
|
18
|
+
export const renderCompactLogo = (color) => {
|
|
19
|
+
if (!color)
|
|
20
|
+
return [...compactTerminalLogo];
|
|
21
|
+
return compactTerminalLogo.map(line => [...line].map((character, index) => {
|
|
22
|
+
const fraction = index / (line.length - 1);
|
|
23
|
+
const red = Math.round(255 - 95 * fraction), green = Math.round(130 - 40 * fraction), blue = Math.round(215 + 25 * fraction);
|
|
24
|
+
return `\x1b[38;2;${red};${green};${blue}m${character}`;
|
|
25
|
+
}).join("") + "\x1b[0m");
|
|
26
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Pipes inside code spans and escaped pipes are cell content, not separators. */
|
|
2
|
+
export declare const splitTableRow: (line: string) => string[];
|
|
3
|
+
/** Render Markdown blocks before wrapping; no source text becomes terminal control. */
|
|
4
|
+
export declare const markdownRows: (text: string, width: number) => string[];
|
|
5
|
+
//# sourceMappingURL=TerminalMarkdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalMarkdown.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalMarkdown.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAAM,EAoBlD,CAAC;AA6CF,uFAAuF;AACvF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAAM,EAwBhE,CAAC"}
|