@lazyingart/agintiflow 0.20.331 → 0.20.336-integration.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +2 -0
  2. package/bin/aginti-document-worker-runtime-check.js +12 -0
  3. package/bin/aginti-document-worker.js +10 -0
  4. package/bin/aginti-execution-worker.js +26 -0
  5. package/bin/aginti-integration-analysis-state.js +10 -0
  6. package/bin/aginti-integration-analysis.js +7 -0
  7. package/bin/aginti-public-research.js +1 -0
  8. package/bin/aginti-worker-directory.js +178 -0
  9. package/docs/integration-analysis-state-migration.md +47 -0
  10. package/docs/integration-deep-research.md +9 -0
  11. package/docs/integration-worker-directory.md +99 -0
  12. package/docs/labcanvas-chatops-fallback.md +139 -0
  13. package/docs/supervision-campaign-ledger.md +1851 -0
  14. package/examples/document-worker/README.md +84 -0
  15. package/examples/document-worker/aginti-document-worker.service +67 -0
  16. package/examples/document-worker/document-worker.json +12 -0
  17. package/examples/document-worker/runtime-manifest.json +28 -0
  18. package/package.json +89 -4
  19. package/scripts/fixtures/integration-document-worker-smoke-fixture.js +190 -0
  20. package/scripts/fixtures/loopback-test-port.mjs +16 -0
  21. package/scripts/github-hosted-release-environment.js +22 -0
  22. package/scripts/live-production-planner-smoke.js +70 -0
  23. package/scripts/smoke-canvas-artifacts.js +203 -0
  24. package/scripts/smoke-coding-tools.js +676 -1
  25. package/scripts/smoke-docker-command.js +24 -0
  26. package/scripts/smoke-dynamic-step-budget.js +1032 -27
  27. package/scripts/smoke-execution-runtime-bundle.js +248 -0
  28. package/scripts/smoke-execution-worker-server.js +138 -0
  29. package/scripts/smoke-execution-worker-systemd-boundary.js +545 -0
  30. package/scripts/smoke-execution-worker.js +791 -0
  31. package/scripts/smoke-integration-analysis-api-server.js +1038 -0
  32. package/scripts/smoke-integration-analysis-coordinator.js +1035 -0
  33. package/scripts/smoke-integration-analysis-planner.js +5366 -0
  34. package/scripts/smoke-integration-analysis-session-authority-contract.js +223 -0
  35. package/scripts/smoke-integration-analysis-session-service.js +4628 -0
  36. package/scripts/smoke-integration-analysis-startup-recovery.js +846 -0
  37. package/scripts/smoke-integration-analysis-state-migrator.js +765 -0
  38. package/scripts/smoke-integration-analysis-state-prewrite-gate.js +1170 -0
  39. package/scripts/smoke-integration-api.js +2275 -0
  40. package/scripts/smoke-integration-authorities.js +3338 -0
  41. package/scripts/smoke-integration-document-artifacts.js +431 -0
  42. package/scripts/smoke-integration-document-content.js +244 -0
  43. package/scripts/smoke-integration-document-revision.js +909 -0
  44. package/scripts/smoke-integration-document-session-broker.js +1374 -0
  45. package/scripts/smoke-integration-document-worker-contract.js +197 -0
  46. package/scripts/smoke-integration-document-worker-cross-boundary.js +209 -0
  47. package/scripts/smoke-integration-document-worker-longevity.js +257 -0
  48. package/scripts/smoke-integration-document-worker-real-compile.js +138 -0
  49. package/scripts/smoke-integration-document-worker-server.js +411 -0
  50. package/scripts/smoke-integration-document-worker-service.js +214 -0
  51. package/scripts/smoke-integration-document-worker-store.js +419 -0
  52. package/scripts/smoke-integration-document-worker-systemd-boundary.js +353 -0
  53. package/scripts/smoke-integration-execution-worker-binding-config.js +102 -0
  54. package/scripts/smoke-integration-grounded-search.js +1355 -0
  55. package/scripts/smoke-integration-sandbox-profile.js +982 -0
  56. package/scripts/smoke-integration-worker-directory-cli.js +37 -0
  57. package/scripts/smoke-integration-worker-directory.js +399 -0
  58. package/scripts/smoke-local-failure-recovery.js +28 -0
  59. package/scripts/smoke-math-rendering.js +2 -1
  60. package/scripts/smoke-model-roles.js +46 -0
  61. package/scripts/smoke-public-research-wrapper.js +11 -3
  62. package/scripts/smoke-runtime-compat.js +8 -1
  63. package/scripts/smoke-scs-evidence-visibility.js +65 -0
  64. package/scripts/smoke-session-runtime.js +28 -0
  65. package/scripts/smoke-skills.js +174 -0
  66. package/scripts/smoke-tmux-tools.js +26 -0
  67. package/scripts/smoke-toolchain-docker.js +18 -0
  68. package/scripts/smoke-truthful-completion.js +3547 -117
  69. package/scripts/smoke-web-api.js +11 -2
  70. package/scripts/smoke-web-ui.js +11 -2
  71. package/scripts/smoke-webapp-command.js +67 -25
  72. package/scripts/test-document-worker-fixture.js +426 -0
  73. package/skills/deep-research/SKILL.md +1 -0
  74. package/src/agent-runner.js +3552 -174
  75. package/src/config.js +11 -5
  76. package/src/docker-sandbox.js +51 -9
  77. package/src/execution-runtime-bundle.js +639 -0
  78. package/src/execution-worker-api.js +245 -0
  79. package/src/execution-worker-client.js +1017 -0
  80. package/src/execution-worker-jobs.js +399 -0
  81. package/src/execution-worker-server.js +239 -0
  82. package/src/execution-worker-systemd-boundary.js +654 -0
  83. package/src/execution-worker.js +1453 -0
  84. package/src/guardrails.js +8 -1
  85. package/src/integration-analysis-cli.js +255 -0
  86. package/src/integration-analysis-config.js +614 -0
  87. package/src/integration-analysis-coordinator.js +529 -0
  88. package/src/integration-analysis-planner.js +4647 -0
  89. package/src/integration-analysis-server.js +778 -0
  90. package/src/integration-analysis-session-contract.js +18 -0
  91. package/src/integration-analysis-session-service.js +8269 -0
  92. package/src/integration-analysis-state-migration-cli.js +366 -0
  93. package/src/integration-analysis-state-migrator.js +591 -0
  94. package/src/integration-analysis-state-persistence.js +17 -0
  95. package/src/integration-analysis-vision.js +1086 -0
  96. package/src/integration-api.js +1505 -38
  97. package/src/integration-artifacts.js +235 -7
  98. package/src/integration-auth.js +1 -1
  99. package/src/integration-core-event-projector.js +10 -0
  100. package/src/integration-document-artifacts.js +492 -0
  101. package/src/integration-document-blob-store.js +226 -0
  102. package/src/integration-document-worker-cli.js +186 -0
  103. package/src/integration-document-worker-client.js +1719 -0
  104. package/src/integration-document-worker-config.js +299 -0
  105. package/src/integration-document-worker-contract.js +790 -0
  106. package/src/integration-document-worker-requirements.js +119 -0
  107. package/src/integration-document-worker-runtime.js +199 -0
  108. package/src/integration-document-worker-server.js +565 -0
  109. package/src/integration-document-worker-service.js +448 -0
  110. package/src/integration-document-worker-store.js +1837 -0
  111. package/src/integration-durable-common.js +586 -68
  112. package/src/integration-events.js +12 -2
  113. package/src/integration-execution-worker-binding-config.js +223 -0
  114. package/src/integration-execution-worker-router.js +428 -0
  115. package/src/integration-explicit-python.js +247 -0
  116. package/src/integration-expression-plot.js +361 -0
  117. package/src/integration-file-worker-client.js +725 -0
  118. package/src/integration-file-worker-contract.js +559 -0
  119. package/src/integration-file-worker-store.js +1100 -0
  120. package/src/integration-grounded-search.js +2612 -0
  121. package/src/integration-idempotency-store.js +429 -10
  122. package/src/integration-policy.js +242 -8
  123. package/src/integration-tex-compiler.js +654 -0
  124. package/src/integration-worker-directory.js +1015 -0
  125. package/src/json-extraction.js +66 -0
  126. package/src/model-client.js +293 -2
  127. package/src/perception-tools.js +3 -63
  128. package/src/permission-advice.js +152 -3
  129. package/src/public-research-server.js +1 -1
  130. package/src/response-only-source-quality.js +356 -0
  131. package/src/scs-controller.js +37 -1
  132. package/src/scs-evidence.js +516 -32
  133. package/src/session-runtime.js +8 -0
  134. package/src/skill-library.js +81 -5
  135. package/src/step-budget-controller.js +175 -18
  136. package/src/tmux-tools.js +10 -1
  137. package/src/web-query-privacy.js +44 -0
  138. package/src/web-search.js +11 -0
  139. package/src/workspace-tools.js +92 -1
@@ -0,0 +1,84 @@
1
+ # Workstation document worker example
2
+
3
+ This example is deployment input, not an installed service. It deliberately
4
+ starts in the read/delete rollback floor with `creation.enabled=false`.
5
+ Readiness, staged-receipt commit, content reads, and two-phase delete remain
6
+ available; only new compile requests return `WORKER_CREATION_DISABLED` (503).
7
+
8
+ The fixed application listener is `127.0.0.1:18102`. LazyEdge is the only
9
+ intended caller and injects the distinct upstream application bearer. Store the
10
+ same bare upstream capability in a protected LazyEdge worker binding file and
11
+ in the root-owned, mode `0400`, non-symlink systemd credential source:
12
+
13
+ `/etc/agintiflow/credentials/document-worker-upstream-token`
14
+
15
+ The service receives it only through systemd at:
16
+
17
+ `/run/credentials/aginti-document-worker.service/document-worker-upstream-token`
18
+
19
+ Do not put that value in the JSON config, an environment variable, an argument,
20
+ logs, documentation, or Git. The dedicated `aginti-document-worker` user/group,
21
+ selected release path, config, and credential must be created by a reviewed
22
+ deployment step; this example does not create them. Before installing the unit,
23
+ deployment must replace `RELEASE_SHA256` with the exact lowercase SHA-256 release
24
+ identifier. No mutable `current` entry is permitted beside `releases` and
25
+ `runtimes` under `/opt/agintiflow-document-worker`.
26
+ The root-only installer creates the mode `0755` `releases` child and performs
27
+ each no-replace release rename inside that child; the application root itself
28
+ can remain frozen at mode `0555` throughout staging.
29
+
30
+ The unit never executes the workstation's `/usr/bin/node` or a user-owned Node
31
+ path. A reviewed root bootstrap first verifies the versioned Node 22.21.0
32
+ source, then installs the exact binary at the immutable `/opt` path recorded in
33
+ `runtime-manifest.json`. The binary and its four application runtime
34
+ directories are all `root:root` mode `0555`; `/` and `/opt` remain `root:root`
35
+ mode `0755`. `ProtectHome=tmpfs` therefore needs no home-directory exception.
36
+ Before enable, deployment must verify the version, SHA-256, ownership, mode,
37
+ size, ancestry, and exact runtime inventories, then run both the CLI check and
38
+ real bwrap/latexmk/qpdf activation canary under the installed unit.
39
+ Both `ExecStartPre` checks and `ExecStart` use that same immutable Node. The
40
+ worker repeats the no-follow identity, hash, stable-ancestry, and inventory
41
+ checks after exec and fails unless it is running from that exact path as the
42
+ non-root service user/group. Thus a later automatic restart does not trust
43
+ deployment-time evidence alone.
44
+ The second `ExecStartPre` is the exact mode-aware in-unit `check`. It always
45
+ validates the immutable runtime, protected config/credential, and durable store.
46
+ When `creation.enabled=true`, it additionally runs one bounded,
47
+ network-isolated LaTeX/qpdf canary and refuses startup if that compiler proof
48
+ fails. When `creation.enabled=false`, it deliberately does not touch the TeX
49
+ toolchain: readiness advertises `compiler:null`, compile remains disabled, and
50
+ the retained full/range read plus two-phase-delete floor can restart even while
51
+ the compiler is unavailable.
52
+ The exact installed candidate unit must complete `aginti-document-worker check`
53
+ successfully before LazyEdge route activation, AgInTi broker activation, or Web
54
+ exposure is allowed; static unit verification is not a substitute for that
55
+ namespace and compiler activation proof.
56
+
57
+ LazyEdge permits two concurrent requests and the worker admits at most one
58
+ compiler process; at most four additional compiles remain in a bounded
59
+ in-process queue and excess admission fails retryably.
60
+ The private ledger also enforces fixed group/directory bounds, per-source and
61
+ per-PDF limits, and an 8 GiB aggregate live-object ceiling; quota exhaustion
62
+ does not disable existing reads or two-phase deletion.
63
+ Each compiler process has a 30-second wall limit. The 120-second private-route
64
+ timeout is intentionally longer so queueing, forced cleanup, and a structured
65
+ failure response retain transport headroom.
66
+
67
+ Completed deletion receipts are retained for the most recent 512 delete
68
+ transactions. Compaction removes only groups whose two objects are already
69
+ durably tombstoned; it never removes staged, committed, prepared, or deleting
70
+ groups. Within that window, compile/commit/delete response loss replays exactly.
71
+ When full tombstones are compacted, the store atomically advances a durable
72
+ compile-authority epoch in the same ledger replacement. New clients fetch that
73
+ epoch immediately before compiling and bind it into the deterministic request
74
+ ID. Old content/commit/delete replay resolves as not-found, while a delayed old
75
+ compile request carries a stale epoch and remains 410 Gone. Existing live-group
76
+ replay remains exact. This bounded cutoff has no practical lifetime delete
77
+ ceiling and the 4,096-entry live-ledger cap is no longer a lifetime creation
78
+ limit.
79
+
80
+ The TeX compiler uses bubblewrap namespaces. Therefore the unit intentionally
81
+ does not use `RestrictNamespaces=true`; it denies only time namespaces. Every
82
+ candidate unit must run the real bwrap/latexmk/qpdf activation canary under the
83
+ installed unit before creation is enabled. A hash-only executable check is not
84
+ an activation proof.
@@ -0,0 +1,67 @@
1
+ [Unit]
2
+ Description=AgInTi workstation document artifact worker
3
+ Documentation=https://flow.lazying.art
4
+ After=local-fs.target
5
+
6
+ [Service]
7
+ Type=simple
8
+ User=aginti-document-worker
9
+ Group=aginti-document-worker
10
+ UMask=0077
11
+ Environment=PATH=/usr/sbin:/usr/bin:/sbin:/bin
12
+ WorkingDirectory=/var/lib/aginti-document-worker
13
+ ExecStartPre=/opt/agintiflow-document-worker/runtimes/node-v22.21.0-29e9c28204d89d85/bin/node /opt/agintiflow-document-worker/releases/RELEASE_SHA256/bin/aginti-document-worker-runtime-check.js
14
+ ExecStartPre=/opt/agintiflow-document-worker/runtimes/node-v22.21.0-29e9c28204d89d85/bin/node /opt/agintiflow-document-worker/releases/RELEASE_SHA256/bin/aginti-document-worker.js check --config /etc/agintiflow/document-worker.json
15
+ ExecStart=/opt/agintiflow-document-worker/runtimes/node-v22.21.0-29e9c28204d89d85/bin/node /opt/agintiflow-document-worker/releases/RELEASE_SHA256/bin/aginti-document-worker.js serve --config /etc/agintiflow/document-worker.json
16
+ LoadCredential=document-worker-upstream-token:/etc/agintiflow/credentials/document-worker-upstream-token
17
+ StateDirectory=aginti-document-worker
18
+ StateDirectoryMode=0700
19
+ RuntimeDirectory=aginti-document-worker
20
+ RuntimeDirectoryMode=0700
21
+ Restart=on-failure
22
+ RestartSec=2s
23
+ TimeoutStartSec=120s
24
+ TimeoutStopSec=15s
25
+ KillMode=mixed
26
+ KillSignal=SIGTERM
27
+ NoNewPrivileges=yes
28
+ PrivateTmp=yes
29
+ PrivateDevices=yes
30
+ PrivateIPC=yes
31
+ ProtectSystem=strict
32
+ ProtectHome=tmpfs
33
+ ProtectKernelTunables=yes
34
+ ProtectKernelModules=yes
35
+ ProtectKernelLogs=yes
36
+ ProtectClock=yes
37
+ ProtectControlGroups=yes
38
+ ProtectHostname=yes
39
+ ProtectProc=invisible
40
+ ProcSubset=pid
41
+ RestrictAddressFamilies=AF_UNIX AF_INET AF_NETLINK
42
+ RestrictNamespaces=~time
43
+ RestrictRealtime=yes
44
+ RestrictSUIDSGID=yes
45
+ LockPersonality=yes
46
+ SystemCallArchitectures=native
47
+ CapabilityBoundingSet=
48
+ AmbientCapabilities=
49
+ IPAddressDeny=any
50
+ IPAddressAllow=localhost
51
+ SocketBindDeny=any
52
+ SocketBindAllow=tcp:18102
53
+ ReadOnlyPaths=/etc/agintiflow/document-worker.json
54
+ InaccessiblePaths=/etc/agintiflow/credentials
55
+ InaccessiblePaths=/var/lib/lazyedge
56
+ InaccessiblePaths=/var/lib/agintiflow-integration
57
+ MemoryMax=1610612736
58
+ MemorySwapMax=0
59
+ TasksMax=64
60
+ CPUQuota=200%
61
+ CPUQuotaPeriodSec=100ms
62
+ LimitNOFILE=512
63
+ LimitCORE=0
64
+ OOMPolicy=kill
65
+
66
+ [Install]
67
+ WantedBy=multi-user.target
@@ -0,0 +1,12 @@
1
+ {
2
+ "schemaVersion": "aginti-document-worker-service-config-v1",
3
+ "listen": {
4
+ "host": "127.0.0.1",
5
+ "port": 18102
6
+ },
7
+ "stateRoot": "/var/lib/aginti-document-worker",
8
+ "creation": {
9
+ "enabled": false,
10
+ "maximumConcurrentCompiles": 1
11
+ }
12
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "schemaVersion": "aginti-document-worker-runtime-manifest-v1",
3
+ "node": {
4
+ "path": "/opt/agintiflow-document-worker/runtimes/node-v22.21.0-29e9c28204d89d85/bin/node",
5
+ "version": "v22.21.0",
6
+ "sha256": "29e9c28204d89d85cc426b518b4a7c6e32aafecd5e447d65301ffb2c1c15335a",
7
+ "owner": "root",
8
+ "group": "root",
9
+ "mode": "0555",
10
+ "size": 123351032,
11
+ "unitMount": "none"
12
+ },
13
+ "immutableAncestry": {
14
+ "owner": "root",
15
+ "group": "root",
16
+ "mode": "0555",
17
+ "applicationRootEntries": [
18
+ "releases",
19
+ "runtimes"
20
+ ],
21
+ "paths": [
22
+ "/opt/agintiflow-document-worker",
23
+ "/opt/agintiflow-document-worker/runtimes",
24
+ "/opt/agintiflow-document-worker/runtimes/node-v22.21.0-29e9c28204d89d85",
25
+ "/opt/agintiflow-document-worker/runtimes/node-v22.21.0-29e9c28204d89d85/bin"
26
+ ]
27
+ }
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.20.331",
3
+ "version": "0.20.336-integration.2",
4
4
  "type": "module",
5
5
  "description": "AgInTiFlow is a project-aware agent workspace for hybrid wet-dry R&D, hardware-aware intelligence, software automation, and industrial workflows.",
6
6
  "license": "Apache-2.0",
@@ -31,6 +31,12 @@
31
31
  "access": "public"
32
32
  },
33
33
  "exports": {
34
+ "./document-worker": "./src/integration-document-worker-service.js",
35
+ "./document-worker/config": "./src/integration-document-worker-config.js",
36
+ "./document-worker/contract": "./src/integration-document-worker-contract.js",
37
+ "./document-worker/server": "./src/integration-document-worker-server.js",
38
+ "./document-worker/store": "./src/integration-document-worker-store.js",
39
+ "./document-worker/runtime": "./src/integration-document-worker-runtime.js",
34
40
  "./public-research": "./src/public-research-wrapper.js",
35
41
  "./public-research/server": "./src/public-research-server.js",
36
42
  "./safe-chat": "./src/safe-chat-wrapper.js",
@@ -46,6 +52,7 @@
46
52
  "bin/",
47
53
  "docs/",
48
54
  "docker/",
55
+ "examples/document-worker/",
49
56
  "demos/agintiflow-cli-launch.jpg",
50
57
  "demos/agintiflow-web-console-run-output.jpg",
51
58
  "i18n/",
@@ -81,6 +88,41 @@
81
88
  "scripts/smoke-integration-retained-runtime-repository-phase-b.js",
82
89
  "scripts/smoke-integration-runtime-repository-contract.js",
83
90
  "scripts/smoke-integration-runtime-authority.js",
91
+ "scripts/smoke-integration-api.js",
92
+ "scripts/smoke-integration-authorities.js",
93
+ "scripts/smoke-integration-execution-worker-binding-config.js",
94
+ "scripts/smoke-integration-worker-directory.js",
95
+ "scripts/smoke-integration-worker-directory-cli.js",
96
+ "scripts/smoke-integration-sandbox-profile.js",
97
+ "scripts/smoke-execution-worker.js",
98
+ "scripts/smoke-execution-runtime-bundle.js",
99
+ "scripts/smoke-execution-worker-server.js",
100
+ "scripts/smoke-execution-worker-systemd-boundary.js",
101
+ "scripts/smoke-integration-analysis-coordinator.js",
102
+ "scripts/smoke-integration-document-artifacts.js",
103
+ "scripts/smoke-integration-document-content.js",
104
+ "scripts/smoke-integration-document-revision.js",
105
+ "scripts/smoke-integration-document-session-broker.js",
106
+ "scripts/smoke-integration-document-worker-contract.js",
107
+ "scripts/smoke-integration-document-worker-store.js",
108
+ "scripts/smoke-integration-document-worker-longevity.js",
109
+ "scripts/smoke-integration-document-worker-service.js",
110
+ "scripts/smoke-integration-document-worker-server.js",
111
+ "scripts/github-hosted-release-environment.js",
112
+ "scripts/smoke-integration-document-worker-systemd-boundary.js",
113
+ "scripts/smoke-integration-document-worker-real-compile.js",
114
+ "scripts/smoke-integration-document-worker-cross-boundary.js",
115
+ "scripts/test-document-worker-fixture.js",
116
+ "scripts/fixtures/integration-document-worker-smoke-fixture.js",
117
+ "scripts/smoke-integration-grounded-search.js",
118
+ "scripts/smoke-integration-analysis-planner.js",
119
+ "scripts/smoke-integration-analysis-session-service.js",
120
+ "scripts/smoke-integration-analysis-startup-recovery.js",
121
+ "scripts/smoke-integration-analysis-session-authority-contract.js",
122
+ "scripts/smoke-integration-analysis-state-migrator.js",
123
+ "scripts/smoke-integration-analysis-state-prewrite-gate.js",
124
+ "scripts/smoke-integration-analysis-api-server.js",
125
+ "scripts/live-production-planner-smoke.js",
84
126
  "scripts/smoke-auxiliary-tools.js",
85
127
  "scripts/smoke-agentlink.js",
86
128
  "scripts/smoke-auth.js",
@@ -115,6 +157,7 @@
115
157
  "scripts/smoke-runtime-core.js",
116
158
  "scripts/smoke-mcp.js",
117
159
  "scripts/fixtures/mcp-stdio-smoke-server.mjs",
160
+ "scripts/fixtures/loopback-test-port.mjs",
118
161
  "scripts/smoke-model-roles.js",
119
162
  "scripts/smoke-platform.js",
120
163
  "scripts/smoke-perception-research.js",
@@ -143,7 +186,12 @@
143
186
  "bin": {
144
187
  "aginti": "bin/aginti-cli.js",
145
188
  "aginti-cli": "bin/aginti-cli.js",
189
+ "aginti-execution-worker": "bin/aginti-execution-worker.js",
190
+ "aginti-worker-directory": "bin/aginti-worker-directory.js",
191
+ "aginti-document-worker": "bin/aginti-document-worker.js",
146
192
  "aginti-integration": "bin/aginti-integration.js",
193
+ "aginti-integration-analysis": "bin/aginti-integration-analysis.js",
194
+ "aginti-integration-analysis-state": "bin/aginti-integration-analysis-state.js",
147
195
  "aginti-public-research": "bin/aginti-public-research.js",
148
196
  "aginti-safe-chat": "bin/aginti-safe-chat.js"
149
197
  },
@@ -226,11 +274,47 @@
226
274
  "smoke:integration-retained-runtime-repository-phase-b": "node scripts/smoke-integration-retained-runtime-repository-phase-b.js",
227
275
  "smoke:integration-runtime-repository-contract": "node scripts/smoke-integration-runtime-repository-contract.js",
228
276
  "smoke:integration-runtime-authority": "node scripts/smoke-integration-runtime-authority.js",
277
+ "smoke:integration-api": "node scripts/smoke-integration-api.js",
278
+ "smoke:integration-authorities": "node scripts/smoke-integration-authorities.js",
279
+ "smoke:integration-execution-worker-binding-config": "node scripts/smoke-integration-execution-worker-binding-config.js",
280
+ "smoke:integration-worker-directory": "node scripts/smoke-integration-worker-directory.js",
281
+ "smoke:integration-worker-directory-cli": "node scripts/smoke-integration-worker-directory-cli.js",
282
+ "smoke:integration-sandbox-profile": "node scripts/smoke-integration-sandbox-profile.js",
283
+ "smoke:execution-worker": "node scripts/smoke-execution-worker.js",
284
+ "smoke:execution-runtime-bundle": "node scripts/smoke-execution-runtime-bundle.js",
285
+ "smoke:execution-worker-server": "node scripts/smoke-execution-worker-server.js",
286
+ "smoke:execution-worker-systemd-boundary": "node scripts/smoke-execution-worker-systemd-boundary.js",
287
+ "smoke:integration-analysis-coordinator": "node scripts/smoke-integration-analysis-coordinator.js",
288
+ "smoke:integration-document-artifacts": "node scripts/smoke-integration-document-artifacts.js",
289
+ "smoke:integration-document-content": "node scripts/smoke-integration-document-content.js",
290
+ "smoke:integration-document-revision": "node scripts/smoke-integration-document-revision.js",
291
+ "smoke:integration-document-session-broker": "node scripts/smoke-integration-document-session-broker.js",
292
+ "smoke:integration-document-worker-contract": "node scripts/smoke-integration-document-worker-contract.js",
293
+ "smoke:integration-document-worker-store": "node scripts/smoke-integration-document-worker-store.js",
294
+ "smoke:integration-document-worker-longevity": "node scripts/smoke-integration-document-worker-longevity.js",
295
+ "smoke:integration-document-worker-service": "node scripts/smoke-integration-document-worker-service.js",
296
+ "smoke:integration-document-worker-server": "node scripts/smoke-integration-document-worker-server.js",
297
+ "smoke:integration-document-worker-systemd-boundary": "node scripts/smoke-integration-document-worker-systemd-boundary.js",
298
+ "smoke:integration-document-worker-real-compile": "node scripts/smoke-integration-document-worker-real-compile.js",
299
+ "smoke:integration-document-worker-cross-boundary": "node scripts/smoke-integration-document-worker-cross-boundary.js .",
300
+ "smoke:integration-file-worker-store": "node scripts/smoke-integration-file-worker-store.js",
301
+ "smoke:integration-file-worker-client": "node scripts/smoke-integration-file-worker-client.js",
302
+ "test:document-worker": "npm run smoke:integration-document-worker-contract && npm run smoke:integration-document-worker-store && npm run smoke:integration-document-worker-longevity && npm run smoke:integration-document-worker-service && npm run smoke:integration-document-worker-server && npm run smoke:integration-document-worker-systemd-boundary && npm run smoke:integration-document-worker-real-compile",
303
+ "smoke:integration-grounded-search": "node scripts/smoke-integration-grounded-search.js",
304
+ "smoke:integration-analysis-planner": "node scripts/smoke-integration-analysis-planner.js",
305
+ "smoke:integration-analysis-session-service": "node scripts/smoke-integration-analysis-session-service.js",
306
+ "smoke:integration-analysis-context-compaction": "node scripts/smoke-integration-analysis-context-compaction.js",
307
+ "smoke:integration-analysis-startup-recovery": "node scripts/smoke-integration-analysis-startup-recovery.js",
308
+ "smoke:integration-analysis-session-authority-contract": "node scripts/smoke-integration-analysis-session-authority-contract.js",
309
+ "smoke:integration-analysis-state-migrator": "node scripts/smoke-integration-analysis-state-migrator.js",
310
+ "smoke:integration-analysis-state-prewrite-gate": "node scripts/smoke-integration-analysis-state-prewrite-gate.js",
311
+ "smoke:integration-analysis-api-server": "node scripts/smoke-integration-analysis-api-server.js",
312
+ "smoke:integration-analysis-live": "node scripts/live-production-planner-smoke.js",
229
313
  "storage:migrate": "node bin/aginti-cli.js storage migrate",
230
314
  "publish:env": "node scripts/npm-publish-from-env.js publish --access public",
231
315
  "publish:env:whoami": "node scripts/npm-publish-from-env.js whoami",
232
- "pretest": "npm run smoke:planning-timeout-recovery",
233
- "test": "npm run check && npm run smoke:integration-production-mount && npm run smoke:integration-production-runtime-bundle && npm run smoke:integration-retained-idempotency-store && npm run smoke:integration-storage-authority && npm run smoke:integration-retained-durable-common && npm run smoke:integration-retained-file-lock && npm run smoke:integration-retained-event-ledger && npm run smoke:integration-retained-event-ledger-bundle && npm run smoke:integration-retained-repository-kernel && npm run smoke:integration-retained-session-state-store && npm run smoke:integration-retained-native-session-repository-state && npm run smoke:integration-retained-native-execution-evidence && npm run smoke:integration-retained-runtime-repository-surface && npm run smoke:integration-retained-runtime-repository-phase-b && npm run smoke:integration-runtime-repository-contract && npm run smoke:integration-runtime-authority && npm run smoke:localllm-provider && npm run smoke:localllm-model-tiers && npm run smoke:localllm-code-routing && npm run smoke:local-failure-recovery && npm run smoke:localllm-auto-max && npm run smoke:local-resource-policy && npm run smoke:context-budget-recovery && npm run smoke:session-runtime && npm run smoke:runtime-core && npm run smoke:progressive-tools && npm run smoke:scoped-artifact-research && npm run smoke:truthful-completion && npm run smoke:document-artifact-quality && npm run smoke:writing-specialist-routing && npm run smoke:workspace-secret-false-positive && npm run smoke:provider-handoff && npm run eval:local-first-agent && npm run eval:provider-attribution && npm run smoke:runtime-compat && npm run smoke:autoupdate && npm run smoke:web-api && npm run smoke:math-rendering && npm run smoke:web-ui && npm run smoke:web-autostart && npm run smoke:webapp-command && npm run smoke:web-port-fallback && npm run smoke:docker-command && npm run smoke:coding-tools && npm run smoke:dynamic-step-budget && npm run smoke:execution-policy && npm run smoke:aaps-adapter && npm run smoke:auxiliary-tools && npm run smoke:perception-research && npm run smoke:deep-research && npm run smoke:public-research && npm run smoke:safe-chat && npm run smoke:auth && npm run smoke:agentlink && npm run smoke:canvas-artifacts && npm run smoke:capabilities && npm run smoke:mcp && npm run smoke:model-roles && npm run smoke:platform && npm run smoke:permission-modes && npm run smoke:skills && npm run smoke:skillmesh && npm run smoke:supervision-ledger && npm run smoke:tmux-tools && npm run smoke:long-jobs && npm run smoke:run-stdin && npm run smoke:cli-chat && npm run smoke:inbox",
316
+ "pretest": "npm run smoke:planning-timeout-recovery && npm run smoke:integration-production-runtime-bundle && npm run smoke:integration-retained-idempotency-store && npm run smoke:scoped-artifact-research && npm run smoke:document-artifact-quality && npm run smoke:workspace-secret-false-positive && npm run smoke:provider-handoff",
317
+ "test": "npm run check && npm run smoke:integration-production-mount && npm run smoke:integration-storage-authority && npm run smoke:integration-retained-durable-common && npm run smoke:integration-retained-file-lock && npm run smoke:integration-retained-event-ledger && npm run smoke:integration-retained-event-ledger-bundle && npm run smoke:integration-retained-repository-kernel && npm run smoke:integration-retained-session-state-store && npm run smoke:integration-retained-native-session-repository-state && npm run smoke:integration-retained-native-execution-evidence && npm run smoke:integration-retained-runtime-repository-surface && npm run smoke:integration-retained-runtime-repository-phase-b && npm run smoke:integration-runtime-repository-contract && npm run smoke:integration-runtime-authority && npm run smoke:integration-api && npm run smoke:integration-authorities && npm run smoke:integration-execution-worker-binding-config && npm run smoke:integration-worker-directory && npm run smoke:integration-worker-directory-cli && npm run smoke:integration-sandbox-profile && npm run smoke:execution-worker && npm run smoke:execution-runtime-bundle && npm run smoke:execution-worker-server && npm run smoke:execution-worker-systemd-boundary && npm run smoke:integration-analysis-coordinator && npm run smoke:integration-document-artifacts && npm run smoke:integration-document-content && npm run test:document-worker && npm run smoke:integration-document-worker-cross-boundary && npm run smoke:integration-file-worker-store && npm run smoke:integration-file-worker-client && npm run smoke:integration-document-session-broker && npm run smoke:integration-document-revision && npm run smoke:integration-grounded-search && npm run smoke:integration-analysis-planner && npm run smoke:integration-analysis-session-service && npm run smoke:integration-analysis-context-compaction && npm run smoke:integration-analysis-startup-recovery && npm run smoke:integration-analysis-session-authority-contract && npm run smoke:integration-analysis-state-migrator && npm run smoke:integration-analysis-state-prewrite-gate && npm run smoke:integration-analysis-api-server && npm run smoke:localllm-provider && npm run smoke:localllm-model-tiers && npm run smoke:localllm-code-routing && npm run smoke:local-failure-recovery && npm run smoke:localllm-auto-max && npm run smoke:local-resource-policy && npm run smoke:context-budget-recovery && npm run smoke:session-runtime && npm run smoke:runtime-core && npm run smoke:progressive-tools && npm run smoke:truthful-completion && npm run smoke:writing-specialist-routing && npm run eval:local-first-agent && npm run eval:provider-attribution && npm run smoke:runtime-compat && npm run smoke:autoupdate && npm run smoke:web-api && npm run smoke:math-rendering && npm run smoke:web-ui && npm run smoke:web-autostart && npm run smoke:webapp-command && npm run smoke:web-port-fallback && npm run smoke:docker-command && npm run smoke:coding-tools && npm run smoke:dynamic-step-budget && npm run smoke:execution-policy && npm run smoke:aaps-adapter && npm run smoke:auxiliary-tools && npm run smoke:perception-research && npm run smoke:deep-research && npm run smoke:public-research && npm run smoke:safe-chat && npm run smoke:auth && npm run smoke:agentlink && npm run smoke:canvas-artifacts && npm run smoke:capabilities && npm run smoke:mcp && npm run smoke:model-roles && npm run smoke:platform && npm run smoke:permission-modes && npm run smoke:skills && npm run smoke:skillmesh && npm run smoke:supervision-ledger && npm run smoke:tmux-tools && npm run smoke:long-jobs && npm run smoke:run-stdin && npm run smoke:cli-chat && npm run smoke:inbox",
234
318
  "pack:dry-run": "npm pack --dry-run",
235
319
  "smoke:capabilities": "node scripts/smoke-capabilities.js"
236
320
  },
@@ -240,6 +324,7 @@
240
324
  "fast-xml-parser": "^5.8.0",
241
325
  "katex": "0.16.47",
242
326
  "openai": "^6.3.0",
243
- "playwright": "^1.55.0"
327
+ "playwright": "^1.55.0",
328
+ "tldts": "^7.4.11"
244
329
  }
245
330
  }
@@ -0,0 +1,190 @@
1
+ import crypto from "node:crypto";
2
+
3
+ import {
4
+ DOCUMENT_WORKER_SCHEMA_VERSIONS,
5
+ digestDocumentWorkerRequirements,
6
+ documentWorkerCommitManifest,
7
+ } from "../../src/integration-document-worker-contract.js";
8
+ import {
9
+ DOCUMENT_WORKER_LISTEN_HOST,
10
+ DOCUMENT_WORKER_LISTEN_PORT,
11
+ DOCUMENT_WORKER_SERVICE_CONFIG_SCHEMA_VERSION,
12
+ DOCUMENT_WORKER_STATE_ROOT,
13
+ } from "../../src/integration-document-worker-config.js";
14
+
15
+ export const TEST_BEARER_TOKEN = "document-worker-test-token-0123456789abcdef";
16
+ export const TEST_SCOPE = Object.freeze({
17
+ principalId: "principal.document-worker-smoke",
18
+ browserSessionId: "a".repeat(64),
19
+ threadId: "thr_00000000-0000-4000-8000-000000000001",
20
+ runId: "run_00000000-0000-4000-8000-000000000002",
21
+ });
22
+ export const TEST_THREAD_SCOPE = Object.freeze({
23
+ principalId: TEST_SCOPE.principalId,
24
+ browserSessionId: TEST_SCOPE.browserSessionId,
25
+ threadId: TEST_SCOPE.threadId,
26
+ });
27
+ export const TEST_SOURCE = [
28
+ "\\documentclass{article}",
29
+ "\\begin{document}",
30
+ "Document worker smoke test.",
31
+ "\\end{document}",
32
+ "",
33
+ ].join("\n");
34
+
35
+ export function sha256(value) {
36
+ return crypto.createHash("sha256").update(value).digest("hex");
37
+ }
38
+
39
+ export function fixedRequestId(prefix, label) {
40
+ return `${prefix}${sha256(Buffer.from(label, "utf8"))}`;
41
+ }
42
+
43
+ export function testDocumentWorkerConfig(creationEnabled) {
44
+ return Object.freeze({
45
+ schemaVersion: DOCUMENT_WORKER_SERVICE_CONFIG_SCHEMA_VERSION,
46
+ listen: Object.freeze({ host: DOCUMENT_WORKER_LISTEN_HOST, port: DOCUMENT_WORKER_LISTEN_PORT }),
47
+ stateRoot: DOCUMENT_WORKER_STATE_ROOT,
48
+ creation: Object.freeze({ enabled: creationEnabled, maximumConcurrentCompiles: 1 }),
49
+ });
50
+ }
51
+
52
+ export function testRequirements(minimumFigureCount = 0) {
53
+ return Object.freeze({
54
+ schemaVersion: DOCUMENT_WORKER_SCHEMA_VERSIONS.compileRequirements,
55
+ profile: "self-contained-tex-v1",
56
+ minimumFigureCount,
57
+ });
58
+ }
59
+
60
+ export function testCompileRequest(label = "default", overrides = {}) {
61
+ const source = overrides.source ?? TEST_SOURCE;
62
+ const compileAuthorityEpoch = overrides.compileAuthorityEpoch ?? 1;
63
+ const issuanceId = overrides.issuanceId ??
64
+ `iss_${compileAuthorityEpoch.toString(16).padStart(16, "0")}_${sha256(Buffer.from(`issue:${label}`, "utf8"))}`;
65
+ const compileAuthorityToken = overrides.compileAuthorityToken ??
66
+ `wca_${crypto.createHash("sha256").update(`token:${label}`, "utf8").digest("base64url")}`;
67
+ return Object.freeze({
68
+ schemaVersion: DOCUMENT_WORKER_SCHEMA_VERSIONS.compileRequest,
69
+ issuanceId,
70
+ requestId: overrides.requestId ?? fixedRequestId("cmp_", label),
71
+ compileAuthorityEpoch,
72
+ compileAuthorityToken,
73
+ scope: overrides.scope ?? TEST_SCOPE,
74
+ filename: overrides.filename ?? `${label.replace(/[^A-Za-z0-9_-]/gu, "-") || "document"}.tex`,
75
+ source,
76
+ sourceSha256: overrides.sourceSha256 ?? sha256(Buffer.from(source, "utf8")),
77
+ requirements: overrides.requirements ?? testRequirements(0),
78
+ });
79
+ }
80
+
81
+ export function testCompileIssueRequest(label = "default", overrides = {}) {
82
+ const source = overrides.source ?? TEST_SOURCE;
83
+ const compileAuthorityEpoch = overrides.compileAuthorityEpoch ?? 1;
84
+ return Object.freeze({
85
+ schemaVersion: DOCUMENT_WORKER_SCHEMA_VERSIONS.compileIssueRequest,
86
+ issuanceId: overrides.issuanceId ??
87
+ `iss_${compileAuthorityEpoch.toString(16).padStart(16, "0")}_${sha256(Buffer.from(`issue:${label}`, "utf8"))}`,
88
+ compileAuthorityEpoch,
89
+ scope: overrides.scope ?? TEST_SCOPE,
90
+ filename: overrides.filename ?? `${label.replace(/[^A-Za-z0-9_-]/gu, "-") || "document"}.tex`,
91
+ sourceSha256: overrides.sourceSha256 ?? sha256(Buffer.from(source, "utf8")),
92
+ requirements: overrides.requirements ?? testRequirements(0),
93
+ });
94
+ }
95
+
96
+ export async function issueTestCompileRequest(store, label = "default", overrides = {}) {
97
+ const issue = testCompileIssueRequest(label, overrides);
98
+ const authority = await store.issueCompile(issue);
99
+ return testCompileRequest(label, {
100
+ ...overrides,
101
+ issuanceId: authority.issuanceId,
102
+ requestId: authority.requestId,
103
+ compileAuthorityEpoch: authority.compileAuthorityEpoch,
104
+ compileAuthorityToken: authority.compileAuthorityToken,
105
+ });
106
+ }
107
+
108
+ export function fakeCompiledPayload(request, label = "default") {
109
+ const sourceBytes = Buffer.from(request.source, "utf8");
110
+ const pdfBytes = Buffer.from(`%PDF-1.7\n% AgInTi isolated test payload ${label}\n%%EOF\n`, "utf8");
111
+ const sourceSha256 = sha256(sourceBytes);
112
+ const pdfSha256 = sha256(pdfBytes);
113
+ return Object.freeze({
114
+ schemaVersion: "aginti-tex-compiler-v1",
115
+ compilerReceipt: Object.freeze({
116
+ compilerDigest: sha256(Buffer.from("test-compiler", "utf8")),
117
+ compileLogSha256: sha256(Buffer.from(`test-log:${label}`, "utf8")),
118
+ sourceSha256,
119
+ sourceBytes: sourceBytes.byteLength,
120
+ pdfSha256,
121
+ pdfBytes: pdfBytes.byteLength,
122
+ issuedAt: "2026-08-26T00:00:00.000Z",
123
+ }),
124
+ source: Object.freeze({
125
+ filename: request.filename,
126
+ mime: "application/x-tex",
127
+ bytes: sourceBytes,
128
+ sha256: sourceSha256,
129
+ }),
130
+ pdf: Object.freeze({
131
+ filename: `${request.filename.slice(0, -4)}.pdf`,
132
+ mime: "application/pdf",
133
+ bytes: pdfBytes,
134
+ sha256: pdfSha256,
135
+ }),
136
+ });
137
+ }
138
+
139
+ export function testEvidence(request, verifiedFigureCount = 0) {
140
+ return Object.freeze({
141
+ requirementsDigest: digestDocumentWorkerRequirements(request.requirements),
142
+ verifiedFigureCount,
143
+ });
144
+ }
145
+
146
+ export function testCommitRequest(compileResponse, scope = TEST_SCOPE, label = "default") {
147
+ return Object.freeze({
148
+ schemaVersion: DOCUMENT_WORKER_SCHEMA_VERSIONS.commitRequest,
149
+ requestId: fixedRequestId("cmt_", label),
150
+ scope,
151
+ receiptDigest: compileResponse.receipt.digest,
152
+ objects: documentWorkerCommitManifest(compileResponse.artifacts),
153
+ });
154
+ }
155
+
156
+ export function testContentRequest(compileResponse, role = "pdf", overrides = {}) {
157
+ const artifact = compileResponse.artifacts.find((candidate) => candidate.role === role);
158
+ if (!artifact) throw new Error(`Missing ${role} artifact in smoke fixture.`);
159
+ return Object.freeze({
160
+ schemaVersion: DOCUMENT_WORKER_SCHEMA_VERSIONS.contentRequest,
161
+ scope: overrides.scope ?? TEST_SCOPE,
162
+ ref: artifact.ref,
163
+ receiptDigest: overrides.receiptDigest ?? compileResponse.receipt.digest,
164
+ metadataOnly: overrides.metadataOnly ?? false,
165
+ ...(overrides.range === undefined ? {} : { range: overrides.range }),
166
+ });
167
+ }
168
+
169
+ export function testDeleteRequest(compileResponse, phase, label = "default") {
170
+ const objects = compileResponse.artifacts
171
+ .map((artifact) => Object.freeze({
172
+ ref: artifact.ref,
173
+ runId: TEST_SCOPE.runId,
174
+ receiptDigest: compileResponse.receipt.digest,
175
+ }))
176
+ .sort((left, right) => left.ref < right.ref ? -1 : left.ref > right.ref ? 1 : 0);
177
+ return Object.freeze({
178
+ schemaVersion: DOCUMENT_WORKER_SCHEMA_VERSIONS.deleteRequest,
179
+ deletionId: fixedRequestId("del_", label),
180
+ phase,
181
+ scope: TEST_THREAD_SCOPE,
182
+ objects: Object.freeze(objects),
183
+ });
184
+ }
185
+
186
+ export async function readStream(stream) {
187
+ const chunks = [];
188
+ for await (const chunk of stream) chunks.push(Buffer.from(chunk));
189
+ return Buffer.concat(chunks);
190
+ }
@@ -0,0 +1,16 @@
1
+ import net from "node:net";
2
+
3
+ export async function allocateLoopbackTestPort() {
4
+ const reservation = net.createServer((socket) => socket.destroy());
5
+ await new Promise((resolve, reject) => {
6
+ reservation.once("error", reject);
7
+ reservation.listen(0, "127.0.0.1", resolve);
8
+ });
9
+ const address = reservation.address();
10
+ const port = typeof address === "object" && address ? Number(address.port) : 0;
11
+ await new Promise((resolve, reject) => {
12
+ reservation.close((error) => error ? reject(error) : resolve());
13
+ });
14
+ if (!port) throw new Error("kernel did not allocate a loopback test port");
15
+ return port;
16
+ }
@@ -0,0 +1,22 @@
1
+ const RELEASE_REPOSITORY = "lazyingart/AgInTiFlow";
2
+ const RELEASE_WORKFLOW = "Publish npm package";
3
+ const RELEASE_WORKFLOW_PATH = ".github/workflows/npm-publish.yml";
4
+ const RELEASE_TAG_PATTERN = /^v[^/\s]+$/u;
5
+
6
+ export function isPinnedGithubHostedReleaseEnvironment(environment = process.env) {
7
+ const tag = String(environment.GITHUB_REF_NAME || "");
8
+ const ref = `refs/tags/${tag}`;
9
+ return (
10
+ environment.AGINTIFLOW_GITHUB_HOSTED_BWRAP_NAMESPACE_RESTRICTION === "allow-sigkill" &&
11
+ environment.AGINTIFLOW_GITHUB_RUNNER_ENVIRONMENT === "github-hosted" &&
12
+ environment.GITHUB_ACTIONS === "true" &&
13
+ environment.GITHUB_EVENT_NAME === "push" &&
14
+ environment.GITHUB_REPOSITORY === RELEASE_REPOSITORY &&
15
+ environment.GITHUB_REF_TYPE === "tag" &&
16
+ environment.GITHUB_REF === ref &&
17
+ environment.GITHUB_WORKFLOW === RELEASE_WORKFLOW &&
18
+ environment.GITHUB_WORKFLOW_REF === `${RELEASE_REPOSITORY}/${RELEASE_WORKFLOW_PATH}@${ref}` &&
19
+ environment.RUNNER_OS === "Linux" &&
20
+ RELEASE_TAG_PATTERN.test(tag)
21
+ );
22
+ }
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+
5
+ import { createSystemdIntegrationAnalysisCoordinator } from "../src/integration-analysis-coordinator.js";
6
+ import { createIntegrationAnalysisPlanner } from "../src/integration-analysis-planner.js";
7
+
8
+ const CREDENTIAL_ROOT = "/run/credentials/agintiflow-integration.service";
9
+ const LOCAL_LLM_TOKEN_PATH = `${CREDENTIAL_ROOT}/localllm-token`;
10
+
11
+ const coordinator = await createSystemdIntegrationAnalysisCoordinator();
12
+
13
+ try {
14
+ const planner = createIntegrationAnalysisPlanner({
15
+ coordinator,
16
+ localModelConfig: {
17
+ baseURL: "http://127.0.0.1:18080/v1",
18
+ model: "localllm-code",
19
+ apiKey: fs.readFileSync(LOCAL_LLM_TOKEN_PATH, "utf8").trim(),
20
+ contextWindowTokens: 32_768,
21
+ maxOutputTokens: 2_048,
22
+ modelTimeoutMs: 180_000,
23
+ },
24
+ });
25
+ const plannerActivation = await planner.activate();
26
+ const progress = [];
27
+ const streamedArtifacts = [];
28
+ const final = await planner.run(
29
+ {
30
+ principalId: "production-planner-smoke",
31
+ browserSessionId: "a".repeat(64),
32
+ threadId: "thr_11111111-1111-4111-8111-111111111111",
33
+ runId: "run_22222222-2222-4222-8222-222222222222",
34
+ },
35
+ {
36
+ prompt:
37
+ "Run Python code to calculate the squares of 1 through 5. Show a line plot, a table, and a short Markdown summary of the real result.",
38
+ conversation: [],
39
+ },
40
+ {
41
+ onProgress(value) {
42
+ progress.push(value);
43
+ },
44
+ onArtifact(value) {
45
+ streamedArtifacts.push({ id: value.id, kind: value.kind, title: value.title });
46
+ },
47
+ }
48
+ );
49
+
50
+ process.stdout.write(`${JSON.stringify({
51
+ ok: true,
52
+ readiness: plannerActivation.readinessProof,
53
+ plannerActivation,
54
+ plannerAttestation: planner.attestation,
55
+ progress,
56
+ streamedArtifacts,
57
+ final,
58
+ })}\n`);
59
+ } catch (error) {
60
+ process.stderr.write(`${JSON.stringify({
61
+ ok: false,
62
+ name: error?.name || "Error",
63
+ code: error?.code || "UNKNOWN",
64
+ status: error?.status || null,
65
+ message: error?.message || "Production planner smoke failed.",
66
+ })}\n`);
67
+ process.exitCode = 1;
68
+ } finally {
69
+ coordinator.close();
70
+ }