deepclause-sdk 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +5 -0
- package/dist/agent.js.map +1 -1
- package/dist/cli/agent-inbox.d.ts +25 -0
- package/dist/cli/agent-inbox.d.ts.map +1 -0
- package/dist/cli/agent-inbox.js +46 -0
- package/dist/cli/agent-inbox.js.map +1 -0
- package/dist/cli/config.d.ts +28 -28
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +7 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/repl.d.ts +7 -0
- package/dist/cli/repl.d.ts.map +1 -1
- package/dist/cli/repl.js +181 -13
- package/dist/cli/repl.js.map +1 -1
- package/dist/cli/run.d.ts +1 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +3 -1
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/serve.d.ts +3 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +131 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/judge/llm.d.ts.map +1 -1
- package/dist/judge/llm.js +9 -4
- package/dist/judge/llm.js.map +1 -1
- package/dist/judge/types.d.ts +10 -0
- package/dist/judge/types.d.ts.map +1 -1
- package/dist/judge/types.js.map +1 -1
- package/dist/prolog-src/deepclause_mi.pl +370 -54
- package/dist/repl/agent-inbox.d.ts +73 -0
- package/dist/repl/agent-inbox.d.ts.map +1 -0
- package/dist/repl/agent-inbox.js +168 -0
- package/dist/repl/agent-inbox.js.map +1 -0
- package/dist/repl/agent.d.ts +14 -1
- package/dist/repl/agent.d.ts.map +1 -1
- package/dist/repl/agent.js +25 -6
- package/dist/repl/agent.js.map +1 -1
- package/dist/repl/backend.d.ts +6 -0
- package/dist/repl/backend.d.ts.map +1 -1
- package/dist/repl/backend.js +17 -2
- package/dist/repl/backend.js.map +1 -1
- package/dist/repl/event-history.d.ts.map +1 -1
- package/dist/repl/event-history.js +3 -0
- package/dist/repl/event-history.js.map +1 -1
- package/dist/repl/harness-tools.d.ts +9 -2
- package/dist/repl/harness-tools.d.ts.map +1 -1
- package/dist/repl/harness-tools.js +38 -14
- package/dist/repl/harness-tools.js.map +1 -1
- package/dist/repl/history.d.ts +14 -3
- package/dist/repl/history.d.ts.map +1 -1
- package/dist/repl/history.js +62 -5
- package/dist/repl/history.js.map +1 -1
- package/dist/repl/index.d.ts +11 -0
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +6 -2
- package/dist/repl/index.js.map +1 -1
- package/dist/repl/process-backend.d.ts +1 -0
- package/dist/repl/process-backend.d.ts.map +1 -1
- package/dist/repl/process-executor.d.ts +4 -0
- package/dist/repl/process-executor.d.ts.map +1 -1
- package/dist/repl/process-executor.js +36 -1
- package/dist/repl/process-executor.js.map +1 -1
- package/dist/repl/process-worker.d.ts.map +1 -1
- package/dist/repl/process-worker.js +33 -8
- package/dist/repl/process-worker.js.map +1 -1
- package/dist/repl/processes.d.ts +14 -1
- package/dist/repl/processes.d.ts.map +1 -1
- package/dist/repl/processes.js +8 -2
- package/dist/repl/processes.js.map +1 -1
- package/dist/repl/reference.d.ts.map +1 -1
- package/dist/repl/reference.js +4 -3
- package/dist/repl/reference.js.map +1 -1
- package/dist/repl/render.d.ts.map +1 -1
- package/dist/repl/render.js +13 -0
- package/dist/repl/render.js.map +1 -1
- package/dist/repl/session.d.ts +72 -5
- package/dist/repl/session.d.ts.map +1 -1
- package/dist/repl/session.js +595 -42
- package/dist/repl/session.js.map +1 -1
- package/dist/repl/toolset.d.ts +8 -0
- package/dist/repl/toolset.d.ts.map +1 -1
- package/dist/repl/toolset.js +53 -4
- package/dist/repl/toolset.js.map +1 -1
- package/dist/repl/tui/renderer.d.ts.map +1 -1
- package/dist/repl/tui/renderer.js +3 -1
- package/dist/repl/tui/renderer.js.map +1 -1
- package/dist/repl/work-hooks.d.ts +29 -0
- package/dist/repl/work-hooks.d.ts.map +1 -0
- package/dist/repl/work-hooks.js +117 -0
- package/dist/repl/work-hooks.js.map +1 -0
- package/dist/repl/worker-host.d.ts +2 -0
- package/dist/repl/worker-host.d.ts.map +1 -1
- package/dist/repl/worker-host.js +48 -4
- package/dist/repl/worker-host.js.map +1 -1
- package/dist/repl/worker-protocol.d.ts +23 -2
- package/dist/repl/worker-protocol.d.ts.map +1 -1
- package/dist/repl/worker-protocol.js +1 -1
- package/dist/runner.d.ts +2 -2
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +19 -3
- package/dist/runner.js.map +1 -1
- package/dist/runtime-identity.json +6 -6
- package/dist/serve/agent-broadcast.d.ts +29 -0
- package/dist/serve/agent-broadcast.d.ts.map +1 -0
- package/dist/serve/agent-broadcast.js +28 -0
- package/dist/serve/agent-broadcast.js.map +1 -0
- package/dist/serve/agent-preferences.d.ts +16 -0
- package/dist/serve/agent-preferences.d.ts.map +1 -0
- package/dist/serve/agent-preferences.js +42 -0
- package/dist/serve/agent-preferences.js.map +1 -0
- package/dist/serve/api-docs.d.ts +61 -0
- package/dist/serve/api-docs.d.ts.map +1 -0
- package/dist/serve/api-docs.js +122 -0
- package/dist/serve/api-docs.js.map +1 -0
- package/dist/serve/backend.d.ts +12 -0
- package/dist/serve/backend.d.ts.map +1 -0
- package/dist/serve/backend.js +52 -0
- package/dist/serve/backend.js.map +1 -0
- package/dist/serve/capabilities.d.ts +6 -0
- package/dist/serve/capabilities.d.ts.map +1 -0
- package/dist/serve/capabilities.js +21 -0
- package/dist/serve/capabilities.js.map +1 -0
- package/dist/serve/example-agent.d.ts +5 -0
- package/dist/serve/example-agent.d.ts.map +1 -0
- package/dist/serve/example-agent.js +5 -0
- package/dist/serve/example-agent.js.map +1 -0
- package/dist/serve/files.d.ts +55 -0
- package/dist/serve/files.d.ts.map +1 -0
- package/dist/serve/files.js +249 -0
- package/dist/serve/files.js.map +1 -0
- package/dist/serve/harness.d.ts +3 -0
- package/dist/serve/harness.d.ts.map +1 -0
- package/dist/serve/harness.js +53 -0
- package/dist/serve/harness.js.map +1 -0
- package/dist/serve/previews.d.ts +40 -0
- package/dist/serve/previews.d.ts.map +1 -0
- package/dist/serve/previews.js +240 -0
- package/dist/serve/previews.js.map +1 -0
- package/dist/serve/protocol.d.ts +228 -0
- package/dist/serve/protocol.d.ts.map +1 -0
- package/dist/serve/protocol.js +2 -0
- package/dist/serve/protocol.js.map +1 -0
- package/dist/serve/schedules.d.ts +85 -0
- package/dist/serve/schedules.d.ts.map +1 -0
- package/dist/serve/schedules.js +249 -0
- package/dist/serve/schedules.js.map +1 -0
- package/dist/serve/server.d.ts +50 -0
- package/dist/serve/server.d.ts.map +1 -0
- package/dist/serve/server.js +1696 -0
- package/dist/serve/server.js.map +1 -0
- package/dist/serve/session-worker.d.ts +2 -0
- package/dist/serve/session-worker.d.ts.map +1 -0
- package/dist/serve/session-worker.js +291 -0
- package/dist/serve/session-worker.js.map +1 -0
- package/dist/serve/sessions.d.ts +178 -0
- package/dist/serve/sessions.d.ts.map +1 -0
- package/dist/serve/sessions.js +905 -0
- package/dist/serve/sessions.js.map +1 -0
- package/dist/serve/storage.d.ts +41 -0
- package/dist/serve/storage.d.ts.map +1 -0
- package/dist/serve/storage.js +211 -0
- package/dist/serve/storage.js.map +1 -0
- package/dist/serve/ui/api-docs.html +17 -0
- package/dist/serve/ui/api-docs.js +36 -0
- package/dist/serve/ui/app.js +958 -0
- package/dist/serve/ui/authoring.js +92 -0
- package/dist/serve/ui/deepclause-logo.png +0 -0
- package/dist/serve/ui/deepclause-mark.svg +1 -0
- package/dist/serve/ui/diff.js +16 -0
- package/dist/serve/ui/dompurify-LICENSE.txt +202 -0
- package/dist/serve/ui/features.css +15 -0
- package/dist/serve/ui/files.js +13 -0
- package/dist/serve/ui/ibm-plex-mono-latin.woff2 +0 -0
- package/dist/serve/ui/ibmplexmono-OFL.txt +93 -0
- package/dist/serve/ui/icons.js +30 -0
- package/dist/serve/ui/index.html +68 -0
- package/dist/serve/ui/manrope-OFL.txt +93 -0
- package/dist/serve/ui/manrope-latin.woff2 +0 -0
- package/dist/serve/ui/markdown.js +38 -0
- package/dist/serve/ui/marked-LICENSE.txt +44 -0
- package/dist/serve/ui/marked.js +88 -0
- package/dist/serve/ui/purify.js +2454 -0
- package/dist/serve/ui/style.css +249 -0
- package/dist/serve/ui/web-work.css +247 -0
- package/dist/serve/ui/web.css +1848 -0
- package/dist/serve/workflow-bundles.d.ts +8 -0
- package/dist/serve/workflow-bundles.d.ts.map +1 -0
- package/dist/serve/workflow-bundles.js +78 -0
- package/dist/serve/workflow-bundles.js.map +1 -0
- package/dist/serve/workflow-calls.d.ts +6 -0
- package/dist/serve/workflow-calls.d.ts.map +1 -0
- package/dist/serve/workflow-calls.js +13 -0
- package/dist/serve/workflow-calls.js.map +1 -0
- package/dist/serve/workflows.d.ts +93 -0
- package/dist/serve/workflows.d.ts.map +1 -0
- package/dist/serve/workflows.js +219 -0
- package/dist/serve/workflows.js.map +1 -0
- package/dist/system/assets/docs/AGENT_PROMPT.md +6 -6
- package/dist/system/assets/docs/DML_AUTHORING.md +80 -2
- package/dist/system/assets/docs/DML_PROCESSES.md +24 -0
- package/dist/system/assets/docs/DML_REFERENCE.md +98 -10
- package/dist/system/assets/docs/DML_SHELL.md +149 -7
- package/dist/system/assets/docs/DML_TASKS.md +10 -3
- package/dist/system/assets/docs/LOCAL_AGENT_PROMPT.md +6 -6
- package/dist/system/environment.d.ts +5 -1
- package/dist/system/environment.d.ts.map +1 -1
- package/dist/system/environment.js +14 -8
- package/dist/system/environment.js.map +1 -1
- package/dist/system/runtime/agentvm-manager.d.ts +12 -1
- package/dist/system/runtime/agentvm-manager.d.ts.map +1 -1
- package/dist/system/runtime/agentvm-manager.js +136 -20
- package/dist/system/runtime/agentvm-manager.js.map +1 -1
- package/dist/system/runtime/shell-manager.d.ts +3 -0
- package/dist/system/runtime/shell-manager.d.ts.map +1 -1
- package/dist/system/runtime/shell-manager.js +1 -1
- package/dist/system/runtime/shell-manager.js.map +1 -1
- package/dist/system/timezone.d.ts +20 -0
- package/dist/system/timezone.d.ts.map +1 -0
- package/dist/system/timezone.js +37 -0
- package/dist/system/timezone.js.map +1 -0
- package/dist/types.d.ts +37 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/work/index.d.ts +13 -3
- package/dist/work/index.d.ts.map +1 -1
- package/dist/work/index.js +80 -15
- package/dist/work/index.js.map +1 -1
- package/docs/DEEP_RESEARCH_EXAMPLE.md +127 -0
- package/docs/SERVE.md +664 -0
- package/docs/WORK_AGENT_HOOKS_PLAN.md +416 -0
- package/docs/WORK_AGENT_INBOX.md +140 -0
- package/docs/WORK_AGENT_INBOX_PLAN.md +91 -0
- package/docs/WORK_MODE.md +269 -0
- package/package.json +24 -2
- package/sdk-examples/deep-research.dml +144 -0
- package/sdk-examples/deep-research.py +502 -0
- package/sdk-examples/hooked-agent.dml +49 -0
- package/sdk-examples/subagent-inbox.dml +66 -0
- package/src/prolog-src/deepclause_mi.pl +370 -54
|
@@ -12,6 +12,11 @@ Facts and rules use Prolog syntax and end with periods. Predicates are identifie
|
|
|
12
12
|
by name/arity (ALL inputs and outputs). `agent_main/N` is an OPTIONAL positional
|
|
13
13
|
run entry point; all its arguments are inputs. Libraries and explicit workflow
|
|
14
14
|
or goal calls can name any predicate. Normal Work conversation uses shell/1.
|
|
15
|
+
An agent shell may opt into `inbox: _{sources:[process]}` (Work contract 3).
|
|
16
|
+
Capture agent_self/1 in the owning foreground, pass the reference to children,
|
|
17
|
+
and agent_post/3 their data results to schedule another on_message turn without a
|
|
18
|
+
human/browser. See shell/processes topics for provenance, consume, limits and
|
|
19
|
+
restore semantics. No custom input loop or automatic process recovery is implied.
|
|
15
20
|
`doc(Name/Arity, Text)` describes modes and an example; `module_doc(Text)` describes
|
|
16
21
|
purpose; `schema/2` defines model data shapes; `script_file/2` links bundled files.
|
|
17
22
|
Use distinct script link/predicate names, e.g. extract_py versus extract/2.
|
|
@@ -66,15 +71,22 @@ text/vision and fails if no image backend is configured.
|
|
|
66
71
|
`push_context(clear)` also starts empty. Use with_fresh_memory for normal scopes.
|
|
67
72
|
A nested task in a tool starts fresh; explicit arguments carry context. Processes
|
|
68
73
|
have independent memory. A fresh prompt does not see attached images.
|
|
74
|
+
Opt-in Work `on_start`/`on_message` hooks bridge their successful DML memory edits
|
|
75
|
+
into the agent's effective messages. Hooks use `Hook(Context,StateIn,StateOut,Decision)`;
|
|
76
|
+
message decisions are continue, reply(Text), or reject(Reason). Return normally,
|
|
77
|
+
not through answer/suspend. See `shell` for state, provenance and lifecycle rules.
|
|
69
78
|
|
|
70
79
|
`with_tools([Name,...], Goal)` limits nested task tools; `without_tools` excludes
|
|
71
|
-
names. `with_model(Spec, Goal)` uses a different available model for scoped
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
names. `with_model(Spec, Goal)` uses a different available model for scoped
|
|
81
|
+
task/prompt/llm calls, sample_token/2-3, and LLM-backed judgments; string specs
|
|
82
|
+
use provider:model and optional #reasoning, or a model dict. It does not switch
|
|
83
|
+
the judgment backend: fixed-model backends (Jev, mock, custom services) keep
|
|
84
|
+
their own model. `with_reasoning(Goal, Level)` (GOAL FIRST) scopes supported
|
|
85
|
+
reasoning effort. `with_recipe(Goal, Query)` adds transient recipe context when
|
|
86
|
+
the embedding has configured a recipe library; it is not persistent memory. Use
|
|
87
|
+
`with_judgment`/`require_judgment` to choose the judgment backend or require a
|
|
88
|
+
capability. Never invent a model id or infer credentials. Use current
|
|
89
|
+
models/catalog.
|
|
78
90
|
|
|
79
91
|
## Sampling
|
|
80
92
|
|
|
@@ -85,11 +97,55 @@ use that fallback as evidence that an external condition was verified.
|
|
|
85
97
|
This is for a grammar/label frontier, not a replacement for typed task outputs.
|
|
86
98
|
`with_model` applies to it. For a semantic bounded choice prefer choose/4.
|
|
87
99
|
|
|
100
|
+
## Clock and date
|
|
101
|
+
|
|
102
|
+
`get_time(Stamp)` reads runtime epoch seconds without a host tool, and needs no
|
|
103
|
+
network or model. For UTC today: `stamp_date_time(Stamp,DT,'UTC'),
|
|
104
|
+
format_time(string(Date),"%Y-%m-%d",DT)`.
|
|
105
|
+
|
|
106
|
+
The engine is WebAssembly without tzdata, so `stamp_date_time/3` accepts only
|
|
107
|
+
`'UTC'` or an explicit integer offset in seconds — an IANA zone name there is a
|
|
108
|
+
domain error. Use the zone predicates instead; they resolve DST at that instant
|
|
109
|
+
through the host's time-zone database and then call `stamp_date_time/3`:
|
|
110
|
+
|
|
111
|
+
```prolog
|
|
112
|
+
today_in(Zone, Date) :-
|
|
113
|
+
get_time(Stamp),
|
|
114
|
+
zone_date_time(Stamp, Zone, DT),
|
|
115
|
+
format_time(string(Date), "%Y-%m-%d", DT).
|
|
116
|
+
|
|
117
|
+
market_date_ny(Date) :- today_in('America/New_York', Date).
|
|
118
|
+
today_local(Date) :- get_time(Stamp), local_date_time(Stamp, DT),
|
|
119
|
+
format_time(string(Date), "%Y-%m-%d", DT).
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`zone_offset(Zone, Stamp, OffsetSeconds)` returns the offset east of UTC
|
|
123
|
+
(`28800` for UTC+8) when you need the number itself. Pass it to
|
|
124
|
+
`stamp_date_time/3` as `-OffsetSeconds`: that builtin's integer zone counts
|
|
125
|
+
seconds *west* of UTC, the opposite sign. `zone_date_time/3` already does this. `'Local'` means the server's own zone and can change with DST, so
|
|
126
|
+
name an explicit market zone for dated market reports. Use get_time first; Date is
|
|
127
|
+
an ISO date string. A market-local date and last trading
|
|
128
|
+
session require an explicit timezone/calendar policy. See authoring for a recipe.
|
|
129
|
+
|
|
130
|
+
## Workflow calls
|
|
131
|
+
|
|
132
|
+
Same-module predicates are ordinary Prolog calls. With the serve host capability,
|
|
133
|
+
`run_workflow(Name, InputsDict, Result)` invokes an existing named workflow using
|
|
134
|
+
the root turn's pinned catalog. Inspect reference topic workflows first. Check
|
|
135
|
+
Result.ok/status/error and consume Result.outputs by exact named key. Typed inputs,
|
|
136
|
+
cancellation, depth/call limits and normal runtime permissions apply. Authors may
|
|
137
|
+
inspect the catalog and execute real workflows from draft tests under the same
|
|
138
|
+
configured host policy; external effects are not rolled back.
|
|
139
|
+
No implicit host grant exists in other SDK embeddings. See shell for a full recipe.
|
|
140
|
+
|
|
88
141
|
## Host calls and scripts
|
|
89
142
|
|
|
90
143
|
`exec(Tool(key: Value,...), Result)` invokes a CURRENT registered host capability.
|
|
91
144
|
Do not copy an arbitrary tool name from another embedding. Read topic tools for
|
|
92
|
-
actual schemas; topic python is the browser
|
|
145
|
+
actual schemas and draft/published scope restrictions; topic python is the browser
|
|
146
|
+
Python contract, not a promise that Python is registered here. Tool-free prompts
|
|
147
|
+
cannot search. Fresh retrieval needs actual permitted tools/network and cited,
|
|
148
|
+
dated evidence; never silently substitute model knowledge or offline fixtures.
|
|
93
149
|
|
|
94
150
|
`run_script(Name, Args, Value)` resolves script_file(Name, Path), stringifies atomic
|
|
95
151
|
arguments, checks exitCode and parses JSON stdout (else returns stdout).
|
|
@@ -128,7 +184,38 @@ and terminates execution via the answer commit; it does NOT commit code edits.
|
|
|
128
184
|
Workflow/helper/tool outputs must be bound arguments and normal return, not answer.
|
|
129
185
|
|
|
130
186
|
`output(media(Path))`, `output(media{svg: Svg})` display images; `save_image/2`
|
|
131
|
-
saves a reference. Browser `output(html(Path))` renders a workspace miniapp
|
|
187
|
+
saves a reference. Browser `output(html(Path))` renders a workspace miniapp in
|
|
188
|
+
hosts that support it (serve does not execute HTML on the Work origin).
|
|
189
|
+
`output(file("reports/result.csv"))` emits a downloadable workspace-file reference;
|
|
190
|
+
serve validates it and displays a file-icon ribbon. A serve Work Agent can use
|
|
191
|
+
`download_file`, or a relative Markdown link, for the same presentation. Private
|
|
192
|
+
runtime/auth files, traversal and symlinks are rejected; downloads require auth.
|
|
193
|
+
|
|
194
|
+
In serve Work turns and workflows,
|
|
195
|
+
`agent_send(existing(AgentIdOrUniqueName), message{text:Text}, Receipt)` sends to
|
|
196
|
+
an explicitly addressed Work Agent. Enable **Allow incoming messages** separately
|
|
197
|
+
on each receiving Agent (`allowMessages:true` in the host API). Multiple Agents
|
|
198
|
+
may opt in; there is no workspace default and no run-specific recipient grant.
|
|
199
|
+
Names must be exact and unique; IDs survive renames. Disabled, deleted, Develop,
|
|
200
|
+
and closed/saved Agents reject delivery (reopen saved Agents explicitly).
|
|
201
|
+
The host rechecks permission on every send. DML cannot enable receivers.
|
|
202
|
+
`recipient` is only a legacy explicitly supplied run address alias, not a default
|
|
203
|
+
or permission grant. `new(_{title:"Review"})` still requires explicit creation
|
|
204
|
+
permission and creates one receive-enabled result Agent per run.
|
|
205
|
+
Receipt fields `status`, `agent`, `message` acknowledge durable queue acceptance,
|
|
206
|
+
not an Agent reply. Messages have workflow provenance, do not grant authority,
|
|
207
|
+
and never trigger Develop authoring. Tests record previews without sending.
|
|
208
|
+
`agent_recipients(Agents)` lists minimal live opted-in Work Agent IDs/names/status;
|
|
209
|
+
busy Agents may queue messages. It excludes authors, runs and closed/disabled
|
|
210
|
+
recipients and does not grant authority or reopen them. `agent_broadcast(message{text:Text},Report)`
|
|
211
|
+
snapshots those recipients, excludes a sending Agent itself, and independently
|
|
212
|
+
rechecks each acceptance with concurrency two. `Report` has `accepted`, `failed`,
|
|
213
|
+
`skipped` counts and `results`; individual failures do not abort other recipients.
|
|
214
|
+
The existing 16-attempt operation budget applies; cancellation skips unsent work,
|
|
215
|
+
not accepted messages. No automatic retries or reply wait. Empty audiences succeed
|
|
216
|
+
with zero counts. Draft tests use the same live discovery and real delivery with
|
|
217
|
+
normal receive permissions and operation limits; they are not message previews.
|
|
218
|
+
These optional host capabilities do not change `agent_post/3` process references.
|
|
132
219
|
Read media for distinctions between display, vision and generation.
|
|
133
220
|
|
|
134
221
|
## Data and schemas
|
|
@@ -241,7 +328,8 @@ Choose returns a supplied atom; verify is yes/no/unknown. Supply real evidence;
|
|
|
241
328
|
judgments do not see task memory/images and are not a guarantee of external state.
|
|
242
329
|
`with_judgment(Backend, Goal)` selects a configured backend;
|
|
243
330
|
`require_judgment(Capability, Goal)` requires calibrated/probability/etc support.
|
|
244
|
-
`with_model`
|
|
331
|
+
`with_model` scopes the model used by an LLM-backed judge (`llm`) but does not
|
|
332
|
+
select the backend; Jev, mock, and custom fixed-model backends keep their model.
|
|
245
333
|
|
|
246
334
|
## Constraint search
|
|
247
335
|
|
|
@@ -56,6 +56,55 @@ use a JSON string or a file instead. General task/schema outputs still support
|
|
|
56
56
|
complex values. Runtime tool schemas are authoritative, not a wish list.
|
|
57
57
|
Old `args` is legacy input data only; author new shells with `inputs`/`outputs`.
|
|
58
58
|
|
|
59
|
+
Fields preserve `description` in forms and tool schemas. Inputs are required by
|
|
60
|
+
default. A typed `default` makes an input optional; `required:false` requires a
|
|
61
|
+
default, and `required:true` cannot also have one. For example:
|
|
62
|
+
`_{name:"Date",type:string,description:"Empty means today's UTC date",default:""}`.
|
|
63
|
+
Omitted/undefined inputs use their defaults; explicit empty strings remain empty
|
|
64
|
+
strings for DML to interpret. Null is invalid; false and zero are real values.
|
|
65
|
+
Clearing an optional numeric form field omits it; numeric/boolean defaults must
|
|
66
|
+
have those types, not quoted strings. Outputs may describe their meaning but must
|
|
67
|
+
always bind and cannot declare defaults/required. Every declared input still
|
|
68
|
+
occupies one positional predicate argument, including an omitted defaulted input.
|
|
69
|
+
|
|
70
|
+
## Workflow composition
|
|
71
|
+
|
|
72
|
+
Same-module predicates compose normally. In `serve`, when the host registers the
|
|
73
|
+
run_workflow capability, a workflow can invoke another existing bundled/published
|
|
74
|
+
workflow without copying source:
|
|
75
|
+
|
|
76
|
+
```prolog
|
|
77
|
+
reuse(Text, Report) :-
|
|
78
|
+
run_workflow("Text statistics", _{'Text':Text}, R),
|
|
79
|
+
( get_dict(ok,R,true) ->
|
|
80
|
+
get_dict(outputs,R,Outputs), get_dict('Report',Outputs,Report)
|
|
81
|
+
; throw(error(workflow_failed(R),reuse/2))
|
|
82
|
+
).
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Use the EXACT supplied name and input/output keys from reference topic workflows;
|
|
86
|
+
this example's name/fields are placeholders, not a guaranteed installed workflow.
|
|
87
|
+
The result contains ok/status/outputs/output/elapsedMs and error on failure.
|
|
88
|
+
A missing/deleted workflow or invalid typed inputs fails honestly. Calls run in
|
|
89
|
+
separate ordinary workflow execution sessions; use returned data explicitly, not
|
|
90
|
+
shared memory or another workflow's private predicates. Child runtimes close on
|
|
91
|
+
return and stop their background processes: compose completed results, not detached
|
|
92
|
+
job handles or durable suspended stacks. Pending inputs are on the child run;
|
|
93
|
+
suspended is not success. Work assistant calls to its own bundled workflows retain
|
|
94
|
+
the original owning foreground and process/coordinator semantics. Capabilities remain those
|
|
95
|
+
of the approved server runtime; no new network, credentials or message grants.
|
|
96
|
+
|
|
97
|
+
The root turn captures the catalog's revisions and passes that same catalog down
|
|
98
|
+
all nested calls. Publishing during a call cannot silently switch a downstream
|
|
99
|
+
revision. Deletion still prevents new calls. Cycles are refused; maximum chain
|
|
100
|
+
length is 4 workflows and budget is 16 attempted child calls per root operation,
|
|
101
|
+
with the normal live-session limit and timeouts still applying. Cancellation
|
|
102
|
+
propagates to active children; there is no retry/replay. Draft authors can discover
|
|
103
|
+
contracts and test real workflow calls with the same host policy. These calls have
|
|
104
|
+
real effects; fixtures alone are not live integration verification. Outside serve this predicate requires an explicitly registered
|
|
105
|
+
run_workflow host capability. The Work MODEL's run_workflow tool is distinct from
|
|
106
|
+
DML's three-argument predicate.
|
|
107
|
+
|
|
59
108
|
## Workflows versus tools
|
|
60
109
|
|
|
61
110
|
A workflow is a recurring user task with a prescribed result, e.g. intake,
|
|
@@ -67,19 +116,34 @@ Do not export internal helpers, docs, schemas or all predicates indiscriminately
|
|
|
67
116
|
`shell.tools` is NOT `tool/2`: the latter exposes a predicate to a nested agent
|
|
68
117
|
inside `task/N`, with a single last output and input types in its annotation.
|
|
69
118
|
A predicate may participate in both interfaces if needed, with one implementation.
|
|
70
|
-
Host
|
|
71
|
-
Work image-display helper
|
|
119
|
+
Host capabilities are also accessible to DML through `exec/2`.
|
|
120
|
+
`host_tools: [show_image]` enables the Work image-display helper. To request the
|
|
121
|
+
host's bash tool directly for the Work assistant, use `host_tools: [bash]` (or
|
|
122
|
+
`[bash, show_image]`). Bash is supplied only when registered and allowed by the
|
|
123
|
+
host; its policy/approval wrapper and cancellation still apply. This does not
|
|
124
|
+
expose `execute`, authoring tools, or other registry entries. Bash is powerful:
|
|
125
|
+
use it only with trusted harnesses/users. `deepclause serve` registers bash by
|
|
126
|
+
default; `--no-tools` disables it. DML `exec(bash(...), R)` needs a registered
|
|
127
|
+
bash capability, but does not require declaring bash to the assistant.
|
|
72
128
|
|
|
73
129
|
## Workflow-only shell
|
|
74
130
|
|
|
75
131
|
```prolog
|
|
132
|
+
workflow(_{name:"Uppercase",goal:"uppercase",
|
|
133
|
+
inputs:[_{name:"Text",type:string}],
|
|
134
|
+
outputs:[_{name:"Upper",type:string}]}).
|
|
76
135
|
uppercase(Text, Upper) :- string_upper(Text, Upper).
|
|
77
|
-
shell(_{kind: workflow, system: "", host_tools: [], tools: [],
|
|
78
|
-
workflows: [_{name: "Uppercase", goal: "uppercase",
|
|
79
|
-
inputs: [_{name: "Text", type: string}],
|
|
80
|
-
outputs: [_{name: "Upper", type: string}]}], welcome: "Choose a task."}).
|
|
81
136
|
```
|
|
82
137
|
|
|
138
|
+
Exactly one literal `workflow/1` declaration derives a workflow-only runtime shell
|
|
139
|
+
when no explicit `shell/1` exists. General SDK hosts may still use an explicit
|
|
140
|
+
workflow shell; isolated serve authors instead expose only the declaration,
|
|
141
|
+
implementation/private helpers and supporting assets. They cannot redefine the
|
|
142
|
+
Agent shell, `agent_main`, `bp_*`/`dc_*`, qualified heads or expansion hooks, execute
|
|
143
|
+
arbitrary directives, or replace host-pinned `use_harness` dependencies. A bundled
|
|
144
|
+
source needs reviewed per-workflow ownership provenance; old flattened harnesses
|
|
145
|
+
are not copied into editors. See `docs/SERVE_WORKFLOWS.md` for migration.
|
|
146
|
+
|
|
83
147
|
There is no assistant loop. A manual start executes exactly the selected workflow
|
|
84
148
|
with validated inputs and no intervening assistant call, for BOTH shell kinds.
|
|
85
149
|
Outputs are named typed values; no solution/unbound output/cancel/suspend is not
|
|
@@ -89,12 +153,90 @@ Interactive workflows must run through foreground form/input handlers. Browser
|
|
|
89
153
|
scratch `execute` workers and worker-hosted processes do not support forms.
|
|
90
154
|
Test pure validation/headless paths separately from actual foreground form submits.
|
|
91
155
|
|
|
156
|
+
## Agent hooks (Work contract 2)
|
|
157
|
+
|
|
158
|
+
For per-message routing or explicit application state, keep `kind: agent` and add
|
|
159
|
+
hooks. All hooks have signature `Hook(Context, StateIn, StateOut, Decision)`:
|
|
160
|
+
|
|
161
|
+
```prolog
|
|
162
|
+
initialize(_, _, state{turns: 0}, continue) :-
|
|
163
|
+
system("Be concise and factual.").
|
|
164
|
+
handle_message(Context, State0, state{turns: N}, Decision) :-
|
|
165
|
+
get_dict(turns, State0, Previous), N is Previous + 1,
|
|
166
|
+
get_dict(message, Context, Text),
|
|
167
|
+
( Text == "ping" -> Decision = reply("pong")
|
|
168
|
+
; user("Harness context: turn number {N}."), Decision = continue
|
|
169
|
+
).
|
|
170
|
+
shell(_{kind: agent, system: "Helpful assistant", host_tools: [], tools: [],
|
|
171
|
+
workflows: [], welcome: "Ask a question, or say ping.",
|
|
172
|
+
hooks: _{on_start: "initialize", on_message: "handle_message"}}).
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`on_start` runs once, lazily before the first user message, starting from `state{}`.
|
|
176
|
+
It must return `continue`. `on_message` returns `continue` (default assistant),
|
|
177
|
+
`reply(Text)` (publish directly, no outer assistant call), or `reject(Reason)`.
|
|
178
|
+
Context contains version 1, event, session_id, turn, and message (message hook only).
|
|
179
|
+
State must be bounded ground data: tagged dicts/lists/atoms/strings/finite numbers,
|
|
180
|
+
with safe integers, maximum depth 32 and maximum serialized size 64 KiB.
|
|
181
|
+
|
|
182
|
+
The original user message is already in effective memory. `system/1`, `user/1`,
|
|
183
|
+
and memory-bearing tasks update that context for the next outer model call.
|
|
184
|
+
They do not fabricate visible human turns. `get_memory/1` reads the current hook
|
|
185
|
+
view; provider/tool groups appear as opaque text projections, not writable native
|
|
186
|
+
blobs. `clear_memory` rebuilds editable context, never host policy. Isolated
|
|
187
|
+
prompts and fresh-memory scopes do not leak scratch changes.
|
|
188
|
+
|
|
189
|
+
Hook failure/cancellation discards staged memory/state, with no assistant fallback.
|
|
190
|
+
Rejection commits state but discards staged messages. Hooks execute once, use the
|
|
191
|
+
same policy and shared model budget, and have a 30-second wall-clock bound. Side
|
|
192
|
+
effects cannot be rolled back. Return the decision normally: do not use answer,
|
|
193
|
+
suspend, or an input loop. Internal streams/output are technical activity, not the
|
|
194
|
+
final reply. Initialization/state/context persist on restore; interrupted/failed
|
|
195
|
+
initialization is not replayed. Steering is not yet supported with hooks.
|
|
196
|
+
|
|
197
|
+
Manual workflows still execute directly, and `run_workflow` remains available to
|
|
198
|
+
the normal assistant. Develop, worker-internal work and title/compaction calls do
|
|
199
|
+
not invoke owner hooks; an explicit agent_post delivery does. Only `on_start` and `on_message` are implemented; other keys fail
|
|
200
|
+
validation. No agent_main entry is required.
|
|
201
|
+
|
|
202
|
+
## Work-agent inbox (Work contract 3)
|
|
203
|
+
|
|
204
|
+
Opt in with `inbox: _{sources:[process]}` on an agent shell. Optional max_pending
|
|
205
|
+
(1..32) and max_auto_turns (1..10) lower the host caps. The owning foreground calls
|
|
206
|
+
`agent_self(Agent)` and explicitly passes that reference into a child goal.
|
|
207
|
+
`agent_post(Agent, message{text:Text, data:payload{...}}, MessageId)` queues a new
|
|
208
|
+
agent input; data/key are optional. Acceptance waits for the durable queue write,
|
|
209
|
+
not for an answer. References are not pids or persistable state; a child cannot
|
|
210
|
+
acquire the parent's reference implicitly. Stale/cross-session references fail.
|
|
211
|
+
|
|
212
|
+
The existing on_message context has source=user or source=process (atoms). Process
|
|
213
|
+
inputs also include message_id, authenticated sender pid/name, and data. Continue,
|
|
214
|
+
reply and reject keep their meanings. Process-only consume commits state/memory
|
|
215
|
+
without an outer model call or assistant reply. Human consume is invalid. The
|
|
216
|
+
input stays visibly labelled as background data, not a human submission or policy.
|
|
217
|
+
No hooks are required: absent on_message, the normal assistant handles the input.
|
|
218
|
+
|
|
219
|
+
FIFO deliveries wait until the active operation ends; they do not interrupt or
|
|
220
|
+
recursively invoke hooks. Defaults: 32 queued/running, 16 KiB each, 32 posts/minute,
|
|
221
|
+
10 autonomous turns between human messages/resumes, and at most 10 model calls
|
|
222
|
+
per background turn. Limits/failure pause delivery; no silent retries. Posting
|
|
223
|
+
errors are explicit. Optional key strings deduplicate recent identical posts by
|
|
224
|
+
sender pid. Host policy can disable/tighten the inbox without granting tools.
|
|
225
|
+
|
|
226
|
+
With serve, background execution/replies continue without a browser. Pure-browser
|
|
227
|
+
execution cannot continue after page closure. Restore holds pending inputs and
|
|
228
|
+
marks running inputs interrupted; it never restarts processes or replays effects.
|
|
229
|
+
User messages or explicit resume release held data. Input/approval waits for a
|
|
230
|
+
human. Closing a tab is not closing a session. Consult the shipped
|
|
231
|
+
sdk-examples/subagent-inbox.dml for a complete generic launch/result pattern.
|
|
232
|
+
|
|
92
233
|
## Custom conversation
|
|
93
234
|
|
|
94
235
|
A custom DML `input/1` + `chat/1` loop is for a required protocol or per-turn
|
|
95
236
|
state, e.g. staged intake that validates each stage before advancing. Merely
|
|
96
237
|
asking for a conversational agent or changing its persona does not require it.
|
|
97
|
-
|
|
238
|
+
For a turn-based Work agent, use the inbox above for process results, not next/1.
|
|
239
|
+
Use `next/1` only for an intentionally custom foreground conversation protocol.
|
|
98
240
|
Such loops must run in foreground with an input host, not inside scratch execute.
|
|
99
241
|
See `examples` section `custom-intake` for a minimal custom staged protocol.
|
|
100
242
|
|
|
@@ -60,6 +60,12 @@ be an input or supplied with `system/1` inside that body. A process has its own
|
|
|
60
60
|
memory snapshot. Attached media is harness memory, so a fresh `prompt/N` will
|
|
61
61
|
not see an image attached for a task.
|
|
62
62
|
|
|
63
|
+
Opt-in Work agent hooks are an explicit bridge between these stores: a hook's
|
|
64
|
+
`system/1`, `user/1`, and memory-bearing task changes become effective Work model
|
|
65
|
+
context on successful return. `prompt/N` and fresh-memory isolation still apply.
|
|
66
|
+
This does not change ordinary workflow/authoring memory semantics. See `shell` for
|
|
67
|
+
`on_start`/`on_message`, explicit state, decisions, limits, and restore behavior.
|
|
68
|
+
|
|
63
69
|
## Nested tools
|
|
64
70
|
|
|
65
71
|
Host registration is NOT nested-agent exposure. `exec(python(...), R)` calls a
|
|
@@ -107,6 +113,7 @@ returns a number; `holds/2` succeeds for yes. `judge(State, Specs)` batches
|
|
|
107
113
|
questions such as `choose(Question, Options)-Choice` in one request.
|
|
108
114
|
Judgments do not see task memory or images. Supply observed evidence as State;
|
|
109
115
|
`unknown` is not no, and neither is a failed goal.
|
|
110
|
-
`with_model(Spec, Goal)` changes task/prompt/llm model selection,
|
|
111
|
-
backend selection;
|
|
112
|
-
|
|
116
|
+
`with_model(Spec, Goal)` changes task/prompt/llm and LLM-judge model selection,
|
|
117
|
+
not judgment backend selection; fixed-model judges such as Jev keep their own
|
|
118
|
+
model. Use only model ids available in this session. Read the exact scopes and
|
|
119
|
+
backend capabilities in the language reference before relying on them.
|
|
@@ -9,12 +9,12 @@ features. Never invent a tool, supported parameter or successful result.
|
|
|
9
9
|
|
|
10
10
|
## Work in small verified steps
|
|
11
11
|
|
|
12
|
-
Start small: inspect `listing`,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
results. Side effects are real.
|
|
17
|
-
`Name/Arity` and
|
|
12
|
+
Start small: inspect `listing`, explain the inputs, steps, reuse, capabilities and
|
|
13
|
+
checks; plan WITH the user and wait for approval before edits/tests. Then use
|
|
14
|
+
`begin_turn`, `define`/`delete`, bounded `execute`, `end_turn`; report evidence.
|
|
15
|
+
Reopen a transaction for more edits; rollback a bad one. Add intermediate `output/1`
|
|
16
|
+
to debug; use `bindings: "brief"` for large results. Side effects are real.
|
|
17
|
+
Keep docs, `Name/Arity` and modes accurate.
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
Reply without tool calls to finish or ask the user. You do not call `finish` or
|
|
@@ -22,6 +22,10 @@ export interface EnvironmentBlockOptions {
|
|
|
22
22
|
* the model calls a tool that does not exist.
|
|
23
23
|
*/
|
|
24
24
|
capabilityTool?: string;
|
|
25
|
+
/** Actual DML capability registry. An empty list means no host capabilities. */
|
|
26
|
+
capabilityTools?: string[];
|
|
27
|
+
/** Embeddings with scoped DML task tools must not label those as host grants. */
|
|
28
|
+
capabilityLabel?: string;
|
|
25
29
|
/** Injectable clock, so tests do not depend on the wall calendar. */
|
|
26
30
|
now?: Date;
|
|
27
31
|
}
|
|
@@ -36,7 +40,7 @@ export declare function describeNow(now?: Date): string;
|
|
|
36
40
|
*/
|
|
37
41
|
export declare function describeEnvironment(options?: EnvironmentBlockOptions): string;
|
|
38
42
|
/** `NOW` — always recomputed, so a long session does not read yesterday's date. */
|
|
39
|
-
export declare function describeCurrentTime(now?: Date,
|
|
43
|
+
export declare function describeCurrentTime(now?: Date, _capabilityTool?: string): string;
|
|
40
44
|
/** Both blocks, in the order they should be appended. */
|
|
41
45
|
export declare function describeRuntimeContext(options?: EnvironmentBlockOptions): string;
|
|
42
46
|
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/system/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE/F,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,GAAG,GAAE,IAAiB,GAAG,MAAM,CAoB1D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,uBAA4B,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/system/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE/F,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,GAAG,GAAE,IAAiB,GAAG,MAAM,CAoB1D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,uBAA4B,GAAG,MAAM,CA0CjF;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,IAAiB,EAAE,eAAe,SAAS,GAAG,MAAM,CAW5F;AAED,yDAAyD;AACzD,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,MAAM,CAEpF"}
|
|
@@ -40,24 +40,28 @@ export function describeNow(now = new Date()) {
|
|
|
40
40
|
* the host: that is the WASM filesystem's mount, which is always there.
|
|
41
41
|
*/
|
|
42
42
|
export function describeEnvironment(options = {}) {
|
|
43
|
-
const { workspacePath, environment, capabilityTool } = options;
|
|
43
|
+
const { workspacePath, environment, capabilityTool, capabilityTools } = options;
|
|
44
44
|
const sandboxed = environment?.sandboxed ?? false;
|
|
45
45
|
const workspace = workspacePath ?? process.cwd();
|
|
46
46
|
const label = environment?.backendLabel ?? 'unknown';
|
|
47
|
-
const tool = capabilityTool ?? 'bash'
|
|
47
|
+
const tool = capabilityTools === undefined ? capabilityTool ?? 'bash'
|
|
48
|
+
: capabilityTools.includes(capabilityTool ?? 'bash') ? capabilityTool ?? 'bash'
|
|
49
|
+
: capabilityTools.includes('python') ? 'python' : undefined;
|
|
48
50
|
const lines = [
|
|
49
51
|
'EXECUTION ENVIRONMENT',
|
|
50
52
|
`- Capability backend: ${label}${environment?.description ? ` (${environment.description})` : ''}.`,
|
|
51
53
|
];
|
|
52
54
|
if (!sandboxed) {
|
|
53
|
-
lines.push(`- There is NO sandbox:
|
|
55
|
+
lines.push(`- There is NO sandbox: ${tool ? `\`exec(${tool}(...), Result)\` and the capability tool run` : 'Any granted host shell would run'} as your user `
|
|
54
56
|
+ 'account. Writes outside the workspace are real files on this machine and '
|
|
55
57
|
+ 'persist, and a `rm` is a real `rm`.');
|
|
56
58
|
}
|
|
57
59
|
else {
|
|
58
|
-
lines.push(`-
|
|
60
|
+
lines.push(`- ${tool ? `\`exec(${tool}(...), Result)\` is isolated` : 'Host execution is isolated'} by ${environment?.description}. Writes outside `
|
|
59
61
|
+ 'the workspace stay inside that sandbox and are gone when it ends.');
|
|
60
62
|
}
|
|
63
|
+
if (capabilityTools !== undefined)
|
|
64
|
+
lines.push(`- Registered ${options.capabilityLabel ?? 'DML host capabilities'}: ${capabilityTools.join(', ') || 'none'}. Tool schemas are authoritative; examples never grant absent tools.`);
|
|
61
65
|
lines.push(`- Workspace, as your own tools see it: ${workspace}`, `- Workspace, inside DML and \`exec\`: ${SANDBOX_WORKSPACE_PATH} — and it is the `
|
|
62
66
|
+ `working directory, so \`out.txt\` and \`${SANDBOX_WORKSPACE_PATH}/out.txt\` are the `
|
|
63
67
|
+ 'same file. Prefer this name; it is the same everywhere.', '- Only files under the workspace reach the host. In DML, any other absolute path '
|
|
@@ -69,10 +73,12 @@ export function describeEnvironment(options = {}) {
|
|
|
69
73
|
return lines.join('\n') + '\n';
|
|
70
74
|
}
|
|
71
75
|
/** `NOW` — always recomputed, so a long session does not read yesterday's date. */
|
|
72
|
-
export function describeCurrentTime(now = new Date(),
|
|
73
|
-
const lookup =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
export function describeCurrentTime(now = new Date(), _capabilityTool = 'bash') {
|
|
77
|
+
const lookup = 'use DML `get_time(Stamp)` (no host tool required). For a UTC date: '
|
|
78
|
+
+ '`stamp_date_time(Stamp, DT, \'UTC\'), format_time(string(Date), "%Y-%m-%d", DT)`. '
|
|
79
|
+
+ 'For an IANA zone (DST-correct, e.g. a market clock) use '
|
|
80
|
+
+ '`zone_date_time(Stamp, \'America/New_York\', DT)`; `local_date_time(Stamp, DT)` follows the host zone. '
|
|
81
|
+
+ 'This engine has no tzdata, so `stamp_date_time/3` itself accepts only UTC or an integer offset in seconds.';
|
|
76
82
|
return [
|
|
77
83
|
'NOW',
|
|
78
84
|
`- ${describeNow(now)}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/system/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,sBAAsB,EAA6B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/system/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,sBAAsB,EAA6B,MAAM,4BAA4B,CAAC;AAmB/F,gFAAgF;AAChF,MAAM,UAAU,WAAW,CAAC,MAAY,IAAI,IAAI,EAAE;IAChD,MAAM,KAAK,GAAG,IAAI,IAAI,C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C,sBAAsB,qBAAqB;UACtF,yDAAyD,EAC7D,mFAAmF;UAC/E,iFAAiF;UACjF,YAAY,WAAW,EAAE,IAAI,KAAK,MAAM;YACxC,CAAC,CAAC,wGAAwG;YAC1G,CAAC,CAAC,6EAA6E,EAAE,EACrF,qFAAqF;UACjF,oEAAoE,CACzE,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjC,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,mBAAmB,CAAC,MAAY,IAAI,IAAI,EAAE,EAAE,eAAe,GAAG,MAAM;IAClF,MAAM,MAAM,GAAG,qEAAqE;UAChF,oFAAoF;UACpF,0DAA0D;UAC1D,yGAAyG;UACzG,4GAA4G,CAAC;IACjH,OAAO;QACL,KAAK;QACL,KAAK,WAAW,CAAC,GAAG,CAAC,EAAE;QACvB,uEAAuE,MAAM,GAAG;KACjF,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACtB,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,sBAAsB,CAAC,UAAmC,EAAE;IAC1E,OAAO,KAAK,mBAAmB,CAAC,OAAO,CAAC,KAAK,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC;AAC5G,CAAC"}
|
|
@@ -46,10 +46,21 @@ export declare class AgentVMManager {
|
|
|
46
46
|
private readonly workspacePath;
|
|
47
47
|
private readonly network;
|
|
48
48
|
private readonly defaultTimeoutMs?;
|
|
49
|
+
private readonly onReset?;
|
|
49
50
|
private vm;
|
|
51
|
+
private queue;
|
|
52
|
+
private stopping;
|
|
53
|
+
private generation;
|
|
50
54
|
readonly kind: "sandbox";
|
|
51
|
-
|
|
55
|
+
private forwards;
|
|
56
|
+
private forwarding;
|
|
57
|
+
constructor(workspacePath: string, network: boolean, defaultTimeoutMs?: number | undefined, onReset?: (() => void) | undefined);
|
|
58
|
+
/** Trusted host only: fixed guest address, ephemeral loopback TCP listeners. */
|
|
59
|
+
forwardPort(guestPort: number, signal?: AbortSignal): Promise<number>;
|
|
60
|
+
private openForward;
|
|
61
|
+
removePortForward(guestPort: number): void;
|
|
52
62
|
exec(command: string, signal?: AbortSignal, observer?: ShellExecObserver, options?: ShellExecOptions): Promise<ShellExecResult>;
|
|
63
|
+
private execExclusive;
|
|
53
64
|
dispose(): Promise<void>;
|
|
54
65
|
private getVM;
|
|
55
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentvm-manager.d.ts","sourceRoot":"","sources":["../../../src/system/runtime/agentvm-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agentvm-manager.d.ts","sourceRoot":"","sources":["../../../src/system/runtime/agentvm-manager.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,O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