@bastani/atomic 0.10.4-alpha.2 → 0.10.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 +194 -0
- package/dist/_shared/chunk-CDOYTDYM.js +4 -0
- package/dist/_shared/chunk-CDOYTDYM.js.map +1 -0
- package/dist/_shared/fork-row-index-UAUAQRD5.js +1 -1
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +2 -2
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +1 -1
- package/dist/_shared/mode-shared-HP7GUA7J.js +4 -4
- package/dist/_shared/sdk-WQIOHVKO.js +1 -1
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/sql-session-store-5FD3WBMZ.js +9 -9
- package/dist/_shared/startup-0-0-X4NF3GKM.js +9 -5
- package/dist/_shared/startup-0-0-X4NF3GKM.js.map +1 -1
- package/dist/_shared/startup-0-2-KFDYPDJK.js +1 -1
- package/dist/_shared/startup-0-3-T4DVFYWX.js +2 -2
- package/dist/_shared/startup-0-4-HN5EB4K7.js +1 -1
- package/dist/_shared/startup-0-5-OHJNE6JH.js +3 -3
- package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
- package/dist/_shared/startup-15-1-4S7FLMNG.js +14 -14
- package/dist/_shared/startup-8-0-34CBHPZH.js +23 -23
- package/dist/_shared/startup-8-1-KQJBDKRU.js +12 -12
- package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +1 -1
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +38 -0
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +40 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/CHANGELOG.md +12 -0
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/auth-cli.impl.js +1102 -0
- package/dist/cli/auth-cli.impl.js.map +1 -0
- package/dist/cli/auth-cli.js +28 -1098
- package/dist/cli/auth-cli.js.map +1 -1
- package/dist/cli/blueprint-command.impl.js +906 -0
- package/dist/cli/blueprint-command.impl.js.map +1 -0
- package/dist/cli/blueprint-command.js +27 -901
- package/dist/cli/blueprint-command.js.map +1 -1
- package/dist/cli/intercom-command.impl.js +108 -0
- package/dist/cli/intercom-command.impl.js.map +1 -0
- package/dist/cli/intercom-command.js +29 -105
- package/dist/cli/intercom-command.js.map +1 -1
- package/dist/cli/list-models.impl.js +60 -0
- package/dist/cli/list-models.impl.js.map +1 -0
- package/dist/cli/list-models.js +29 -57
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.impl.js +55 -0
- package/dist/cli/session-picker.impl.js.map +1 -0
- package/dist/cli/session-picker.js +30 -53
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.impl.js +5 -0
- package/dist/cli/startup-ui.impl.js.map +1 -0
- package/dist/cli/startup-ui.js +31 -4
- package/dist/cli/storage-command.impl.js +3 -0
- package/dist/cli/storage-command.impl.js.map +1 -0
- package/dist/cli/storage-command.js +31 -2
- package/dist/cli/storage-search-session.impl.js +189 -0
- package/dist/cli/storage-search-session.impl.js.map +1 -0
- package/dist/cli/storage-search-session.js +29 -186
- package/dist/cli/storage-search-session.js.map +1 -1
- package/dist/cli/team-command.impl.js +217 -0
- package/dist/cli/team-command.impl.js.map +1 -0
- package/dist/cli/team-command.js +29 -214
- package/dist/cli/team-command.js.map +1 -1
- package/dist/core/debug.impl.js +3 -0
- package/dist/core/debug.impl.js.map +1 -0
- package/dist/core/debug.js +31 -2
- package/dist/core/export-html/card-projection.impl.js +257 -0
- package/dist/core/export-html/card-projection.impl.js.map +1 -0
- package/dist/core/export-html/card-projection.js +30 -255
- package/dist/core/export-html/card-projection.js.map +1 -1
- package/dist/core/export-html/index.impl.js +610 -0
- package/dist/core/export-html/index.impl.js.map +1 -0
- package/dist/core/export-html/index.js +28 -606
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/json-spans.impl.js +3 -0
- package/dist/core/export-html/json-spans.impl.js.map +1 -0
- package/dist/core/export-html/json-spans.js +31 -2
- package/dist/core/export-html/oversized-render-inputs.impl.js +125 -0
- package/dist/core/export-html/oversized-render-inputs.impl.js.map +1 -0
- package/dist/core/export-html/oversized-render-inputs.js +28 -121
- package/dist/core/export-html/oversized-render-inputs.js.map +1 -1
- package/dist/core/export-html/tool-renderer.impl.js +350 -0
- package/dist/core/export-html/tool-renderer.impl.js.map +1 -0
- package/dist/core/export-html/tool-renderer.js +29 -347
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/jiti-loader.impl.js +3 -0
- package/dist/core/extensions/jiti-loader.impl.js.map +1 -0
- package/dist/core/extensions/jiti-loader.js +31 -2
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -0
- package/dist/core/extensions/jiti-static-loader.impl.js.map +1 -0
- package/dist/core/extensions/jiti-static-loader.js +31 -2
- package/dist/core/extensions/loader-host-modules.impl.js +3 -0
- package/dist/core/extensions/loader-host-modules.impl.js.map +1 -0
- package/dist/core/extensions/loader-host-modules.js +31 -2
- package/dist/core/intercom-broker-control-host.impl.js +5 -0
- package/dist/core/intercom-broker-control-host.impl.js.map +1 -0
- package/dist/core/intercom-broker-control-host.js +31 -4
- package/dist/core/intercom-broker-control.impl.js +18 -0
- package/dist/core/intercom-broker-control.impl.js.map +1 -0
- package/dist/core/intercom-broker-control.js +31 -17
- package/dist/core/intercom-broker-control.js.map +1 -1
- package/dist/core/package-manager-storage-adapters.impl.js +3 -0
- package/dist/core/package-manager-storage-adapters.impl.js.map +1 -0
- package/dist/core/package-manager-storage-adapters.js +31 -2
- package/dist/core/sdk.impl.js +9 -0
- package/dist/core/sdk.impl.js.map +1 -0
- package/dist/core/sdk.js +31 -8
- package/dist/core/session-manager-core.js +21 -21
- package/dist/core/session-manager-list.impl.js +3 -0
- package/dist/core/session-manager-list.impl.js.map +1 -0
- package/dist/core/session-manager-list.js +31 -2
- package/dist/core/session-manager.impl.js +8 -0
- package/dist/core/session-manager.impl.js.map +1 -0
- package/dist/core/session-manager.js +31 -7
- package/dist/core/session-storage.impl.js +3 -0
- package/dist/core/session-storage.impl.js.map +1 -0
- package/dist/core/session-storage.js +31 -2
- package/dist/core/storage/index.js +6 -6
- package/dist/core/storage/node-sqlite-thread.js +1 -1
- package/dist/core/storage/node-sqlite.js +1 -1
- package/dist/core/storage/offline-snapshot-file.impl.js +37 -0
- package/dist/core/storage/offline-snapshot-file.impl.js.map +1 -0
- package/dist/core/storage/offline-snapshot-file.js +30 -35
- package/dist/core/storage/offline-snapshot-file.js.map +1 -1
- package/dist/core/storage/provider.js +5 -5
- package/dist/core/storage/selection.js +3 -3
- package/dist/core/storage/session/branch-fork-source.impl.js +101 -0
- package/dist/core/storage/session/branch-fork-source.impl.js.map +1 -0
- package/dist/core/storage/session/branch-fork-source.js +29 -98
- package/dist/core/storage/session/branch-fork-source.js.map +1 -1
- package/dist/core/storage/session/card-view.impl.js +60 -0
- package/dist/core/storage/session/card-view.impl.js.map +1 -0
- package/dist/core/storage/session/card-view.js +30 -58
- package/dist/core/storage/session/card-view.js.map +1 -1
- package/dist/core/storage/session/child-reader.impl.js +94 -0
- package/dist/core/storage/session/child-reader.impl.js.map +1 -0
- package/dist/core/storage/session/child-reader.js +29 -91
- package/dist/core/storage/session/child-reader.js.map +1 -1
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -0
- package/dist/core/storage/session/chunked-resume-projection.impl.js.map +1 -0
- package/dist/core/storage/session/chunked-resume-projection.js +31 -2
- package/dist/core/storage/session/expanded-child-details.impl.js +639 -0
- package/dist/core/storage/session/expanded-child-details.impl.js.map +1 -0
- package/dist/core/storage/session/expanded-child-details.js +28 -635
- package/dist/core/storage/session/expanded-child-details.js.map +1 -1
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -0
- package/dist/core/storage/session/fork-row-bytes.impl.js.map +1 -0
- package/dist/core/storage/session/fork-row-bytes.js +31 -2
- package/dist/core/storage/session/fork-row-index.impl.js +3 -0
- package/dist/core/storage/session/fork-row-index.impl.js.map +1 -0
- package/dist/core/storage/session/fork-row-index.js +31 -2
- package/dist/core/storage/session/fork-staging.impl.js +580 -0
- package/dist/core/storage/session/fork-staging.impl.js.map +1 -0
- package/dist/core/storage/session/fork-staging.js +27 -575
- package/dist/core/storage/session/fork-staging.js.map +1 -1
- package/dist/core/storage/session/fork-window.impl.js +477 -0
- package/dist/core/storage/session/fork-window.impl.js.map +1 -0
- package/dist/core/storage/session/fork-window.js +27 -472
- package/dist/core/storage/session/fork-window.js.map +1 -1
- package/dist/core/storage/session/history-pages.impl.js +3 -0
- package/dist/core/storage/session/history-pages.impl.js.map +1 -0
- package/dist/core/storage/session/history-pages.js +31 -2
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -0
- package/dist/core/storage/session/jsonl-entry-projection.impl.js.map +1 -0
- package/dist/core/storage/session/jsonl-entry-projection.js +31 -2
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -0
- package/dist/core/storage/session/jsonl-session-store.impl.js.map +1 -0
- package/dist/core/storage/session/jsonl-session-store.js +31 -2
- package/dist/core/storage/session/memory-session-store.impl.js +3 -0
- package/dist/core/storage/session/memory-session-store.impl.js.map +1 -0
- package/dist/core/storage/session/memory-session-store.js +31 -2
- package/dist/core/storage/session/pinned-branch-resume.impl.js +72 -0
- package/dist/core/storage/session/pinned-branch-resume.impl.js.map +1 -0
- package/dist/core/storage/session/pinned-branch-resume.js +29 -69
- package/dist/core/storage/session/pinned-branch-resume.js.map +1 -1
- package/dist/core/storage/session/released-history-files.impl.js +465 -0
- package/dist/core/storage/session/released-history-files.impl.js.map +1 -0
- package/dist/core/storage/session/released-history-files.js +29 -462
- package/dist/core/storage/session/released-history-files.js.map +1 -1
- package/dist/core/storage/session/resident-fork-rows.impl.js +57 -0
- package/dist/core/storage/session/resident-fork-rows.impl.js.map +1 -0
- package/dist/core/storage/session/resident-fork-rows.js +28 -53
- package/dist/core/storage/session/resident-fork-rows.js.map +1 -1
- package/dist/core/storage/session/session-resume.impl.js +3 -0
- package/dist/core/storage/session/session-resume.impl.js.map +1 -0
- package/dist/core/storage/session/session-resume.js +31 -2
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -0
- package/dist/core/storage/session/snapshot-cut.impl.js.map +1 -0
- package/dist/core/storage/session/snapshot-cut.js +31 -2
- package/dist/core/storage/session/snapshot-history.impl.js +62 -0
- package/dist/core/storage/session/snapshot-history.impl.js.map +1 -0
- package/dist/core/storage/session/snapshot-history.js +30 -60
- package/dist/core/storage/session/snapshot-history.js.map +1 -1
- package/dist/core/storage/session/sql-session-store.impl.js +3 -0
- package/dist/core/storage/session/sql-session-store.impl.js.map +1 -0
- package/dist/core/storage/session/sql-session-store.js +31 -2
- package/dist/core/storage/session/tree-outline.impl.js +3 -0
- package/dist/core/storage/session/tree-outline.impl.js.map +1 -0
- package/dist/core/storage/session/tree-outline.js +31 -2
- package/dist/core/storage/session/tree-presentation.impl.js +342 -0
- package/dist/core/storage/session/tree-presentation.impl.js.map +1 -0
- package/dist/core/storage/session/tree-presentation.js +30 -340
- package/dist/core/storage/session/tree-presentation.js.map +1 -1
- package/dist/core/storage/storage-status.impl.js +3 -0
- package/dist/core/storage/storage-status.impl.js.map +1 -0
- package/dist/core/storage/storage-status.js +31 -2
- package/dist/core/storage/team.impl.js +3 -0
- package/dist/core/storage/team.impl.js.map +1 -0
- package/dist/core/storage/team.js +31 -2
- package/dist/core/structured-output/index.impl.js +3 -0
- package/dist/core/structured-output/index.impl.js.map +1 -0
- package/dist/core/structured-output/index.js +31 -2
- package/dist/core/tasks/task-completion-entry.impl.js +254 -0
- package/dist/core/tasks/task-completion-entry.impl.js.map +1 -0
- package/dist/core/tasks/task-completion-entry.js +30 -252
- package/dist/core/tasks/task-completion-entry.js.map +1 -1
- package/dist/core/tasks/task-file-history.impl.js +379 -0
- package/dist/core/tasks/task-file-history.impl.js.map +1 -0
- package/dist/core/tasks/task-file-history.js +28 -375
- package/dist/core/tasks/task-file-history.js.map +1 -1
- package/dist/core/tasks/task-reference-archive.impl.js +469 -0
- package/dist/core/tasks/task-reference-archive.impl.js.map +1 -0
- package/dist/core/tasks/task-reference-archive.js +31 -468
- package/dist/core/tasks/task-reference-archive.js.map +1 -1
- package/dist/core/tasks/task-reference-identity.impl.js +164 -0
- package/dist/core/tasks/task-reference-identity.impl.js.map +1 -0
- package/dist/core/tasks/task-reference-identity.js +28 -160
- package/dist/core/tasks/task-reference-identity.js.map +1 -1
- package/dist/core/tasks/task-reference-stream.impl.js +3 -0
- package/dist/core/tasks/task-reference-stream.impl.js.map +1 -0
- package/dist/core/tasks/task-reference-stream.js +31 -2
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -0
- package/dist/core/tasks/task-unsaved-answer.impl.js.map +1 -0
- package/dist/core/tasks/task-unsaved-answer.js +31 -2
- package/dist/core/tasks/task-view-source.impl.js +3 -0
- package/dist/core/tasks/task-view-source.impl.js.map +1 -0
- package/dist/core/tasks/task-view-source.js +31 -2
- package/dist/core/tools/read-url.impl.js +1530 -0
- package/dist/core/tools/read-url.impl.js.map +1 -0
- package/dist/core/tools/read-url.js +27 -1525
- package/dist/core/tools/read-url.js.map +1 -1
- package/dist/core/worktree-snapshot/blob-store.js +4 -4
- package/dist/core/worktree-snapshot/errors.impl.js +6 -0
- package/dist/core/worktree-snapshot/errors.impl.js.map +1 -0
- package/dist/core/worktree-snapshot/errors.js +31 -5
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +136 -0
- package/dist/core/worktree-snapshot/session-index-reset.impl.js.map +1 -0
- package/dist/core/worktree-snapshot/session-index-reset.js +30 -134
- package/dist/core/worktree-snapshot/session-index-reset.js.map +1 -1
- package/dist/extensions/codemode/execute.impl.js +618 -0
- package/dist/extensions/codemode/execute.impl.js.map +1 -0
- package/dist/extensions/codemode/execute.js +28 -614
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/renderer.impl.js +110 -0
- package/dist/extensions/codemode/renderer.impl.js.map +1 -0
- package/dist/extensions/codemode/renderer.js +29 -107
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/mcp/cli.impl.js +565 -0
- package/dist/extensions/mcp/cli.impl.js.map +1 -0
- package/dist/extensions/mcp/cli.js +30 -563
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/cli.lazy.impl.js +7 -0
- package/dist/extensions/mcp/cli.lazy.impl.js.map +1 -0
- package/dist/extensions/mcp/cli.lazy.js +32 -7
- package/dist/extensions/mcp/cli.lazy.js.map +1 -1
- package/dist/extensions/mcp/runtime.impl.js +5 -0
- package/dist/extensions/mcp/runtime.impl.js.map +1 -0
- package/dist/extensions/mcp/runtime.js +31 -4
- package/dist/main-first-time-setup.impl.js +12 -0
- package/dist/main-first-time-setup.impl.js.map +1 -0
- package/dist/main-first-time-setup.js +31 -11
- package/dist/main-first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/stored-tree-view.impl.js +293 -0
- package/dist/modes/interactive/components/stored-tree-view.impl.js.map +1 -0
- package/dist/modes/interactive/components/stored-tree-view.js +30 -291
- package/dist/modes/interactive/components/stored-tree-view.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +191 -0
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector-archive.js +30 -189
- package/dist/modes/interactive/components/user-message-selector-archive.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +4 -0
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -0
- package/dist/package-manager-cli.impl.js +1067 -0
- package/dist/package-manager-cli.impl.js.map +1 -0
- package/dist/package-manager-cli.js +32 -1067
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/startup-database-spare.impl.js +108 -0
- package/dist/utils/startup-database-spare.impl.js.map +1 -0
- package/dist/utils/startup-database-spare.js +30 -106
- package/dist/utils/startup-database-spare.js.map +1 -1
- package/dist/utils/tools-manager.impl.js +3 -0
- package/dist/utils/tools-manager.impl.js.map +1 -0
- package/dist/utils/tools-manager.js +31 -2
- package/docs/reference/cli.md +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import "../../_shared/rolldown-runtime-BGM3D5V3.js";
|
|
2
|
+
import { read, skip, stringValue } from "../../_shared/startup-0-5-OHJNE6JH.js";
|
|
3
|
+
// dist/core/tasks/task-completion-entry.js
|
|
4
|
+
function* object(first, fields) {
|
|
5
|
+
if (first.name !== "startObject") {
|
|
6
|
+
yield* skip(first);
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const limit = Math.max(...Object.keys(fields).map((key) => key.length)) + 1;
|
|
10
|
+
for (let token = yield; token.name !== "endObject"; token = yield) {
|
|
11
|
+
const key = yield* stringValue(limit);
|
|
12
|
+
const value = yield;
|
|
13
|
+
if (Object.hasOwn(fields, key)) yield* fields[key](value);
|
|
14
|
+
else yield* skip(value);
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
/** The whole value, as `JSON.parse` builds it, own `__proto__` keys included. */
|
|
19
|
+
function* value(first) {
|
|
20
|
+
switch (first.name) {
|
|
21
|
+
case "startObject": {
|
|
22
|
+
const result = {};
|
|
23
|
+
for (let token = yield; token.name !== "endObject"; token = yield) {
|
|
24
|
+
const key = yield* stringValue();
|
|
25
|
+
Object.defineProperty(result, key, {
|
|
26
|
+
value: yield* value(yield),
|
|
27
|
+
configurable: true,
|
|
28
|
+
enumerable: true,
|
|
29
|
+
writable: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
case "startArray": {
|
|
35
|
+
const result = [];
|
|
36
|
+
for (let token = yield; token.name !== "endArray"; token = yield) result.push(yield* value(token));
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
case "startString": return yield* stringValue();
|
|
40
|
+
case "numberValue": return Number(first.value);
|
|
41
|
+
case "trueValue":
|
|
42
|
+
case "falseValue":
|
|
43
|
+
case "nullValue": return first.value;
|
|
44
|
+
default: throw new SyntaxError(`Unexpected JSON token ${first.name}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function* tag(first) {
|
|
48
|
+
if (first.name === "startString") return yield* stringValue(64);
|
|
49
|
+
yield* skip(first);
|
|
50
|
+
}
|
|
51
|
+
/** Compare a saved string with `expected` as it streams, without building it. */
|
|
52
|
+
function* equals(first, expected) {
|
|
53
|
+
if (first.name !== "startString") {
|
|
54
|
+
yield* skip(first);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
let offset = 0;
|
|
58
|
+
let same = true;
|
|
59
|
+
for (let part = yield; part.name === "stringChunk"; part = yield) {
|
|
60
|
+
same &&= expected.startsWith(part.value, offset);
|
|
61
|
+
offset += part.value.length;
|
|
62
|
+
}
|
|
63
|
+
return same && offset === expected.length;
|
|
64
|
+
}
|
|
65
|
+
/** Select `fields` of the entry's message; a repeated `message` key replaces the earlier one, as in `JSON.parse`. */
|
|
66
|
+
function* message(fields, reset) {
|
|
67
|
+
yield* object(yield, { *message(token) {
|
|
68
|
+
reset();
|
|
69
|
+
yield* object(token, fields);
|
|
70
|
+
} });
|
|
71
|
+
}
|
|
72
|
+
const HEADER_READ = Symbol("header read");
|
|
73
|
+
/**
|
|
74
|
+
* The fields that decide what an entry adds to a card, in one pass that keeps none of its content. The pass ends as
|
|
75
|
+
* soon as they are known, which in a saved row is before its message content.
|
|
76
|
+
*/
|
|
77
|
+
function savedEntryHeader(chunks, throughId, idLimit) {
|
|
78
|
+
return read(chunks, (function* () {
|
|
79
|
+
let boundary = false;
|
|
80
|
+
let seenId = throughId === void 0;
|
|
81
|
+
let type;
|
|
82
|
+
let fields = {};
|
|
83
|
+
let seenCallId = false;
|
|
84
|
+
const known = () => seenId && type !== void 0 && (type !== "message" || fields.role !== void 0 && (fields.role !== "toolResult" || seenCallId));
|
|
85
|
+
try {
|
|
86
|
+
yield* object(yield, {
|
|
87
|
+
*id(token) {
|
|
88
|
+
if (throughId === void 0) yield* skip(token);
|
|
89
|
+
else boundary = yield* equals(token, throughId);
|
|
90
|
+
seenId = true;
|
|
91
|
+
if (known()) throw HEADER_READ;
|
|
92
|
+
},
|
|
93
|
+
*type(token) {
|
|
94
|
+
type = yield* tag(token);
|
|
95
|
+
if (known()) throw HEADER_READ;
|
|
96
|
+
},
|
|
97
|
+
*message(token) {
|
|
98
|
+
fields = {};
|
|
99
|
+
seenCallId = false;
|
|
100
|
+
yield* object(token, {
|
|
101
|
+
*role(role) {
|
|
102
|
+
fields.role = yield* tag(role);
|
|
103
|
+
if (known()) throw HEADER_READ;
|
|
104
|
+
},
|
|
105
|
+
*toolCallId(id) {
|
|
106
|
+
delete fields.toolCallId;
|
|
107
|
+
delete fields.longToolCallId;
|
|
108
|
+
seenCallId = true;
|
|
109
|
+
if (id.name !== "startString") yield* skip(id);
|
|
110
|
+
else {
|
|
111
|
+
const text = yield* stringValue(idLimit + 1);
|
|
112
|
+
if (text.length > idLimit) fields.longToolCallId = true;
|
|
113
|
+
else fields.toolCallId = text;
|
|
114
|
+
}
|
|
115
|
+
if (known()) throw HEADER_READ;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (error !== HEADER_READ) throw error;
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
boundary,
|
|
125
|
+
...type === void 0 ? {} : { type },
|
|
126
|
+
...fields
|
|
127
|
+
};
|
|
128
|
+
})());
|
|
129
|
+
}
|
|
130
|
+
const ESCAPE = new TextEncoder().encode("\\u");
|
|
131
|
+
function indexOf(bytes, needle) {
|
|
132
|
+
search: for (let at = bytes.indexOf(needle[0]); at >= 0 && at <= bytes.length - needle.length; at = bytes.indexOf(needle[0], at + 1)) {
|
|
133
|
+
for (let i = 1; i < needle.length; i++) if (bytes[at + i] !== needle[i]) continue search;
|
|
134
|
+
return at;
|
|
135
|
+
}
|
|
136
|
+
return -1;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Whether a saved row can hold the string `text` anywhere: its bytes spell it, or escape a character somewhere.
|
|
140
|
+
* A row that can't is passed over without tokenizing it.
|
|
141
|
+
*/
|
|
142
|
+
async function savedRowMayHold(chunks, text) {
|
|
143
|
+
const needle = new TextEncoder().encode(text);
|
|
144
|
+
const overlap = Math.max(needle.length, ESCAPE.length) - 1;
|
|
145
|
+
let tail = /* @__PURE__ */ new Uint8Array(0);
|
|
146
|
+
for await (const chunk of chunks) {
|
|
147
|
+
const bytes = new Uint8Array(tail.length + chunk.length);
|
|
148
|
+
bytes.set(tail);
|
|
149
|
+
bytes.set(chunk, tail.length);
|
|
150
|
+
if (indexOf(bytes, needle) >= 0 || indexOf(bytes, ESCAPE) >= 0) return true;
|
|
151
|
+
tail = bytes.slice(Math.max(0, bytes.length - overlap));
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
/** A user message's text as a card's prompt reads it: its string, or its text blocks joined by newlines. */
|
|
156
|
+
function savedUserText(chunks) {
|
|
157
|
+
return read(chunks, (function* () {
|
|
158
|
+
let text;
|
|
159
|
+
yield* message({ *content(token) {
|
|
160
|
+
text = void 0;
|
|
161
|
+
if (token.name === "startString") {
|
|
162
|
+
text = yield* stringValue();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (token.name !== "startArray") {
|
|
166
|
+
yield* skip(token);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const parts = [];
|
|
170
|
+
for (let part = yield; part.name !== "endArray"; part = yield) {
|
|
171
|
+
let type;
|
|
172
|
+
let partText;
|
|
173
|
+
yield* object(part, {
|
|
174
|
+
*type(t) {
|
|
175
|
+
type = yield* tag(t);
|
|
176
|
+
},
|
|
177
|
+
*text(t) {
|
|
178
|
+
partText = void 0;
|
|
179
|
+
if (t.name === "startString") partText = yield* stringValue();
|
|
180
|
+
else yield* skip(t);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
if (type === "text" && partText !== void 0) parts.push(partText);
|
|
184
|
+
}
|
|
185
|
+
text = parts.join("\n");
|
|
186
|
+
} }, () => {
|
|
187
|
+
text = void 0;
|
|
188
|
+
});
|
|
189
|
+
return text;
|
|
190
|
+
})());
|
|
191
|
+
}
|
|
192
|
+
/** An assistant message's tool calls, in order: each one's ID, name and arguments. */
|
|
193
|
+
function savedToolCalls(chunks) {
|
|
194
|
+
return read(chunks, (function* () {
|
|
195
|
+
let calls = [];
|
|
196
|
+
const content = function* (token) {
|
|
197
|
+
calls = [];
|
|
198
|
+
if (token.name !== "startArray") {
|
|
199
|
+
yield* skip(token);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
for (let part = yield; part.name !== "endArray"; part = yield) {
|
|
203
|
+
let type;
|
|
204
|
+
const call = {};
|
|
205
|
+
yield* object(part, {
|
|
206
|
+
*type(t) {
|
|
207
|
+
type = yield* tag(t);
|
|
208
|
+
},
|
|
209
|
+
*id(t) {
|
|
210
|
+
call.id = yield* value(t);
|
|
211
|
+
},
|
|
212
|
+
*name(t) {
|
|
213
|
+
call.name = yield* value(t);
|
|
214
|
+
},
|
|
215
|
+
*arguments(t) {
|
|
216
|
+
call.arguments = yield* value(t);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
if (type === "toolCall") calls.push(call);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
yield* message({ content }, () => {
|
|
223
|
+
calls = [];
|
|
224
|
+
});
|
|
225
|
+
return calls;
|
|
226
|
+
})());
|
|
227
|
+
}
|
|
228
|
+
/** What a card shows of a tool result: its content, details, error flag and duration. */
|
|
229
|
+
function savedToolResult(chunks) {
|
|
230
|
+
return read(chunks, (function* () {
|
|
231
|
+
let result = { hasDetails: false };
|
|
232
|
+
yield* message({
|
|
233
|
+
*content(t) {
|
|
234
|
+
result.content = yield* value(t);
|
|
235
|
+
},
|
|
236
|
+
*details(t) {
|
|
237
|
+
result.hasDetails = true;
|
|
238
|
+
result.details = yield* value(t);
|
|
239
|
+
},
|
|
240
|
+
*isError(t) {
|
|
241
|
+
result.isError = yield* value(t);
|
|
242
|
+
},
|
|
243
|
+
*durationMs(t) {
|
|
244
|
+
result.durationMs = yield* value(t);
|
|
245
|
+
}
|
|
246
|
+
}, () => {
|
|
247
|
+
result = { hasDetails: false };
|
|
248
|
+
});
|
|
249
|
+
return result;
|
|
250
|
+
})());
|
|
251
|
+
}
|
|
252
|
+
export { savedEntryHeader, savedRowMayHold, savedToolCalls, savedToolResult, savedUserText };
|
|
253
|
+
|
|
254
|
+
//# sourceMappingURL=task-completion-entry.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-completion-entry.impl.js","names":[],"sources":["../../../src/core/tasks/task-completion-entry.ts"],"mappings":";;;AASA,UAAU,OAAO,OAAc,QAAc;CAC5C,IAAI,MAAM,SAAS,eAAe;EACjC,OAAO,KAAK,KAAK;EACjB,OAAO;CACR;CACA,MAAM,QAAQ,KAAK,IAAI,GAAG,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI;CAC1E,KAAK,IAAI,QAAQ,OAAO,MAAM,SAAS,aAAa,QAAQ,OAAO;EAClE,MAAM,MAAM,OAAO,YAAY,KAAK;EACpC,MAAM,QAAQ;EACd,IAAI,OAAO,OAAO,QAAQ,GAAG,GAAG,OAAO,OAAO,IAAK,CAAC,KAAK;OACpD,OAAO,KAAK,KAAK;CACvB;CACA,OAAO;AACR;;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C,QAAQ,GAAC;IACT,OAAO,UAAU,OAAO,MAAM,CAAC;GAChC;GACA,CAAC,QAAQ,GAAC;IACT,OAAO,aAAa;IACpB,OAAO,UAAU,OAAO,MAAM,CAAC;GAChC;GACA,CAAC,QAAQ,GAAC;IACT,OAAO,UAAU,OAAO,MAAM,CAAC;GAChC;GACA,CAAC,WAAW,GAAC;IACZ,OAAO,aAAa,OAAO,MAAM,CAAC;GACnC;EACA,SACI;GACJ,SAAS,EAAE,YAAY,MAAK;EAC7B,CAAC;EAEF,OAAO;CACR,EAAA,CAAE,CAAE;AAEN"}
|
|
@@ -1,254 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function* value(first) {
|
|
20
|
-
switch (first.name) {
|
|
21
|
-
case "startObject": {
|
|
22
|
-
const result = {};
|
|
23
|
-
for (let token = yield; token.name !== "endObject"; token = yield) {
|
|
24
|
-
const key = yield* stringValue();
|
|
25
|
-
Object.defineProperty(result, key, {
|
|
26
|
-
value: yield* value(yield),
|
|
27
|
-
configurable: true,
|
|
28
|
-
enumerable: true,
|
|
29
|
-
writable: true
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
case "startArray": {
|
|
35
|
-
const result = [];
|
|
36
|
-
for (let token = yield; token.name !== "endArray"; token = yield) result.push(yield* value(token));
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
case "startString": return yield* stringValue();
|
|
40
|
-
case "numberValue": return Number(first.value);
|
|
41
|
-
case "trueValue":
|
|
42
|
-
case "falseValue":
|
|
43
|
-
case "nullValue": return first.value;
|
|
44
|
-
default: throw new SyntaxError(`Unexpected JSON token ${first.name}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function* tag(first) {
|
|
48
|
-
if (first.name === "startString") return yield* stringValue(64);
|
|
49
|
-
yield* skip(first);
|
|
50
|
-
}
|
|
51
|
-
/** Compare a saved string with `expected` as it streams, without building it. */
|
|
52
|
-
function* equals(first, expected) {
|
|
53
|
-
if (first.name !== "startString") {
|
|
54
|
-
yield* skip(first);
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
let offset = 0;
|
|
58
|
-
let same = true;
|
|
59
|
-
for (let part = yield; part.name === "stringChunk"; part = yield) {
|
|
60
|
-
same &&= expected.startsWith(part.value, offset);
|
|
61
|
-
offset += part.value.length;
|
|
62
|
-
}
|
|
63
|
-
return same && offset === expected.length;
|
|
64
|
-
}
|
|
65
|
-
/** Select `fields` of the entry's message; a repeated `message` key replaces the earlier one, as in `JSON.parse`. */
|
|
66
|
-
function* message(fields, reset) {
|
|
67
|
-
yield* object(yield, { *message(token) {
|
|
68
|
-
reset();
|
|
69
|
-
yield* object(token, fields);
|
|
70
|
-
} });
|
|
71
|
-
}
|
|
72
|
-
const HEADER_READ = Symbol("header read");
|
|
73
|
-
/**
|
|
74
|
-
* The fields that decide what an entry adds to a card, in one pass that keeps none of its content. The pass ends as
|
|
75
|
-
* soon as they are known, which in a saved row is before its message content.
|
|
76
|
-
*/
|
|
77
|
-
function savedEntryHeader(chunks, throughId, idLimit) {
|
|
78
|
-
return read(chunks, (function* () {
|
|
79
|
-
let boundary = false;
|
|
80
|
-
let seenId = throughId === void 0;
|
|
81
|
-
let type;
|
|
82
|
-
let fields = {};
|
|
83
|
-
let seenCallId = false;
|
|
84
|
-
const known = () => seenId && type !== void 0 && (type !== "message" || fields.role !== void 0 && (fields.role !== "toolResult" || seenCallId));
|
|
85
|
-
try {
|
|
86
|
-
yield* object(yield, {
|
|
87
|
-
*id(token) {
|
|
88
|
-
if (throughId === void 0) yield* skip(token);
|
|
89
|
-
else boundary = yield* equals(token, throughId);
|
|
90
|
-
seenId = true;
|
|
91
|
-
if (known()) throw HEADER_READ;
|
|
92
|
-
},
|
|
93
|
-
*type(token) {
|
|
94
|
-
type = yield* tag(token);
|
|
95
|
-
if (known()) throw HEADER_READ;
|
|
96
|
-
},
|
|
97
|
-
*message(token) {
|
|
98
|
-
fields = {};
|
|
99
|
-
seenCallId = false;
|
|
100
|
-
yield* object(token, {
|
|
101
|
-
*role(role) {
|
|
102
|
-
fields.role = yield* tag(role);
|
|
103
|
-
if (known()) throw HEADER_READ;
|
|
104
|
-
},
|
|
105
|
-
*toolCallId(id) {
|
|
106
|
-
delete fields.toolCallId;
|
|
107
|
-
delete fields.longToolCallId;
|
|
108
|
-
seenCallId = true;
|
|
109
|
-
if (id.name !== "startString") yield* skip(id);
|
|
110
|
-
else {
|
|
111
|
-
const text = yield* stringValue(idLimit + 1);
|
|
112
|
-
if (text.length > idLimit) fields.longToolCallId = true;
|
|
113
|
-
else fields.toolCallId = text;
|
|
114
|
-
}
|
|
115
|
-
if (known()) throw HEADER_READ;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
1
|
+
// Written by the build (scripts/in-place-update-gate.mjs): when this module's code cannot load in a process of an earlier release
|
|
2
|
+
// that an in-place update left running, the process is told to restart.
|
|
3
|
+
let module;
|
|
4
|
+
try {
|
|
5
|
+
module = await import("./task-completion-entry.impl.js");
|
|
6
|
+
} catch (error) {
|
|
7
|
+
const root = new URL("../../", import.meta.url);
|
|
8
|
+
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
+
const key = `${root.href}#0.10.4`;
|
|
10
|
+
let release = releases.get(key);
|
|
11
|
+
if (release === undefined) {
|
|
12
|
+
release = (async () => {
|
|
13
|
+
for (const path of ["modes/interactive/interactive-mode-deps.js","_shared/chunk-CDOYTDYM.js","_shared/p0-cli-GUFK7TPN.js"]) {
|
|
14
|
+
try {
|
|
15
|
+
const held = await import(new URL(path, root).href);
|
|
16
|
+
if (typeof held.VERSION === "string") return { version: held.VERSION, name: held.APP_NAME };
|
|
17
|
+
} catch {
|
|
18
|
+
// Not a file this process can load: the next.
|
|
118
19
|
}
|
|
119
|
-
});
|
|
120
|
-
} catch (error) {
|
|
121
|
-
if (error !== HEADER_READ) throw error;
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
boundary,
|
|
125
|
-
...type === void 0 ? {} : { type },
|
|
126
|
-
...fields
|
|
127
|
-
};
|
|
128
|
-
})());
|
|
129
|
-
}
|
|
130
|
-
const ESCAPE = new TextEncoder().encode("\\u");
|
|
131
|
-
function indexOf(bytes, needle) {
|
|
132
|
-
search: for (let at = bytes.indexOf(needle[0]); at >= 0 && at <= bytes.length - needle.length; at = bytes.indexOf(needle[0], at + 1)) {
|
|
133
|
-
for (let i = 1; i < needle.length; i++) if (bytes[at + i] !== needle[i]) continue search;
|
|
134
|
-
return at;
|
|
135
|
-
}
|
|
136
|
-
return -1;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Whether a saved row can hold the string `text` anywhere: its bytes spell it, or escape a character somewhere.
|
|
140
|
-
* A row that can't is passed over without tokenizing it.
|
|
141
|
-
*/
|
|
142
|
-
async function savedRowMayHold(chunks, text) {
|
|
143
|
-
const needle = new TextEncoder().encode(text);
|
|
144
|
-
const overlap = Math.max(needle.length, ESCAPE.length) - 1;
|
|
145
|
-
let tail = /* @__PURE__ */ new Uint8Array(0);
|
|
146
|
-
for await (const chunk of chunks) {
|
|
147
|
-
const bytes = new Uint8Array(tail.length + chunk.length);
|
|
148
|
-
bytes.set(tail);
|
|
149
|
-
bytes.set(chunk, tail.length);
|
|
150
|
-
if (indexOf(bytes, needle) >= 0 || indexOf(bytes, ESCAPE) >= 0) return true;
|
|
151
|
-
tail = bytes.slice(Math.max(0, bytes.length - overlap));
|
|
152
|
-
}
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
/** A user message's text as a card's prompt reads it: its string, or its text blocks joined by newlines. */
|
|
156
|
-
function savedUserText(chunks) {
|
|
157
|
-
return read(chunks, (function* () {
|
|
158
|
-
let text;
|
|
159
|
-
yield* message({ *content(token) {
|
|
160
|
-
text = void 0;
|
|
161
|
-
if (token.name === "startString") {
|
|
162
|
-
text = yield* stringValue();
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
if (token.name !== "startArray") {
|
|
166
|
-
yield* skip(token);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
const parts = [];
|
|
170
|
-
for (let part = yield; part.name !== "endArray"; part = yield) {
|
|
171
|
-
let type;
|
|
172
|
-
let partText;
|
|
173
|
-
yield* object(part, {
|
|
174
|
-
*type(t) {
|
|
175
|
-
type = yield* tag(t);
|
|
176
|
-
},
|
|
177
|
-
*text(t) {
|
|
178
|
-
partText = void 0;
|
|
179
|
-
if (t.name === "startString") partText = yield* stringValue();
|
|
180
|
-
else yield* skip(t);
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
if (type === "text" && partText !== void 0) parts.push(partText);
|
|
184
|
-
}
|
|
185
|
-
text = parts.join("\n");
|
|
186
|
-
} }, () => {
|
|
187
|
-
text = void 0;
|
|
188
|
-
});
|
|
189
|
-
return text;
|
|
190
|
-
})());
|
|
191
|
-
}
|
|
192
|
-
/** An assistant message's tool calls, in order: each one's ID, name and arguments. */
|
|
193
|
-
function savedToolCalls(chunks) {
|
|
194
|
-
return read(chunks, (function* () {
|
|
195
|
-
let calls = [];
|
|
196
|
-
const content = function* (token) {
|
|
197
|
-
calls = [];
|
|
198
|
-
if (token.name !== "startArray") {
|
|
199
|
-
yield* skip(token);
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
for (let part = yield; part.name !== "endArray"; part = yield) {
|
|
203
|
-
let type;
|
|
204
|
-
const call = {};
|
|
205
|
-
yield* object(part, {
|
|
206
|
-
*type(t) {
|
|
207
|
-
type = yield* tag(t);
|
|
208
|
-
},
|
|
209
|
-
*id(t) {
|
|
210
|
-
call.id = yield* value(t);
|
|
211
|
-
},
|
|
212
|
-
*name(t) {
|
|
213
|
-
call.name = yield* value(t);
|
|
214
|
-
},
|
|
215
|
-
*arguments(t) {
|
|
216
|
-
call.arguments = yield* value(t);
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
if (type === "toolCall") calls.push(call);
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
yield* message({ content }, () => {
|
|
223
|
-
calls = [];
|
|
224
|
-
});
|
|
225
|
-
return calls;
|
|
226
|
-
})());
|
|
227
|
-
}
|
|
228
|
-
/** What a card shows of a tool result: its content, details, error flag and duration. */
|
|
229
|
-
function savedToolResult(chunks) {
|
|
230
|
-
return read(chunks, (function* () {
|
|
231
|
-
let result = { hasDetails: false };
|
|
232
|
-
yield* message({
|
|
233
|
-
*content(t) {
|
|
234
|
-
result.content = yield* value(t);
|
|
235
|
-
},
|
|
236
|
-
*details(t) {
|
|
237
|
-
result.hasDetails = true;
|
|
238
|
-
result.details = yield* value(t);
|
|
239
|
-
},
|
|
240
|
-
*isError(t) {
|
|
241
|
-
result.isError = yield* value(t);
|
|
242
|
-
},
|
|
243
|
-
*durationMs(t) {
|
|
244
|
-
result.durationMs = yield* value(t);
|
|
245
20
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
21
|
+
return undefined;
|
|
22
|
+
})();
|
|
23
|
+
releases.set(key, release);
|
|
24
|
+
}
|
|
25
|
+
const running = await release;
|
|
26
|
+
if (running === undefined || running.version === "0.10.4") throw error;
|
|
27
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.4 while this session was running; restart it to keep using /tasks.", {
|
|
28
|
+
cause: error,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export const { savedEntryHeader, savedRowMayHold, savedToolCalls, savedToolResult, savedUserText } = module;
|
|
32
|
+
//# sourceMappingURL=task-completion-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-completion-entry.js","
|
|
1
|
+
{"version":3,"file":"task-completion-entry.js","sources":[],"names":[],"mappings":""}
|