@theokit/sdk 4.21.1 → 4.23.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/dist/compaction.cjs +31 -0
- package/dist/compaction.cjs.map +1 -1
- package/dist/compaction.d.cts +79 -0
- package/dist/compaction.d.ts +79 -0
- package/dist/compaction.js +28 -1
- package/dist/compaction.js.map +1 -1
- package/dist/{cron-Bhdyjl0B.d.ts → cron-B_NkE_VM.d.ts} +15 -1
- package/dist/{cron-M2Xz7lq2.d.cts → cron-x3muPNgg.d.cts} +15 -1
- package/dist/cron.cjs +461 -332
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +461 -332
- package/dist/cron.js.map +1 -1
- package/dist/{errors-gE8612p9.d.cts → errors-BdL-buYn.d.cts} +1 -1
- package/dist/{errors-CG2RpeW-.d.ts → errors-DHZtSNnj.d.ts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +461 -332
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +461 -332
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +634 -503
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -12
- package/dist/index.d.ts +21 -12
- package/dist/index.js +634 -503
- package/dist/index.js.map +1 -1
- package/dist/internal/global-singleton.d.ts +13 -0
- package/dist/internal/llm/openai-messages.d.ts +2 -0
- package/dist/internal/local-agent/mcp-pool.d.ts +41 -0
- package/dist/internal/local-agent/real-local-run.d.ts +2 -0
- package/dist/internal/persistence/index.cjs +3 -1
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +3 -1
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/providers/registry.d.ts +1 -0
- package/dist/internal/runtime/lifecycle/context-budget-event.d.ts +25 -0
- package/dist/internal/runtime/lifecycle/goal-marker.d.ts +13 -0
- package/dist/internal/runtime/lifecycle/run-until.d.ts +0 -1
- package/dist/internal/session/agent-session.d.ts +1 -1
- package/dist/internal/session/session-cache.d.ts +20 -0
- package/dist/models.cjs +11 -15
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +11 -15
- package/dist/models.js.map +1 -1
- package/dist/persistence.cjs +3 -1
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +3 -1
- package/dist/persistence.js.map +1 -1
- package/dist/provider-catalog.json +144 -469
- package/dist/{run-DFM1H2jW.d.cts → run-OJbGyweZ.d.cts} +20 -1
- package/dist/{run-DFM1H2jW.d.ts → run-OJbGyweZ.d.ts} +20 -1
- package/dist/sandbox/index.cjs +47 -15
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +47 -15
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/linux-sandbox.d.cts +16 -6
- package/dist/sandbox/linux-sandbox.d.ts +16 -6
- package/dist/types/agent.d.ts +14 -0
- package/dist/types/run-events.d.ts +20 -1
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js.map +1 -1
- package/package.json +2 -2
- package/dist/goal-loop.d.ts +0 -35
|
@@ -33,6 +33,20 @@ export declare class LinuxSandbox extends LocalSandbox {
|
|
|
33
33
|
});
|
|
34
34
|
/** Extracted for test visibility — delegates to the pure `wrapCommandForSandbox` (M57, single wrap SoT). */
|
|
35
35
|
wrapCommand(command: string): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* M75 review (arquitetura, HIGH) — sem este override a classe MENTIA.
|
|
38
|
+
*
|
|
39
|
+
* `LinuxSandbox` se documenta como "kernel-enforced sandbox backend", mas sobrescrevia apenas
|
|
40
|
+
* `execute`. `uploadFile` continuava o herdado de `LocalSandbox`, que escreve direto no host via
|
|
41
|
+
* `fs/promises` e aceita caminho ABSOLUTO — sem bwrap, sem seccomp, sem restrição de caminho. E
|
|
42
|
+
* `SandboxBackend.writeFile` delega a ele. O resultado era uma classe incoerente: ler, buscar e
|
|
43
|
+
* listar passavam pelo confinamento; escrever, não.
|
|
44
|
+
*
|
|
45
|
+
* Rotear pelo `execute` embrulhado resolve na raiz: a escrita passa a viver sob a MESMA política
|
|
46
|
+
* do resto — se o bwrap nega o caminho, a escrita falha, como deve. O conteúdo vai por stdin (não
|
|
47
|
+
* por argv) porque argv tem limite de tamanho e conteúdo de arquivo não tem.
|
|
48
|
+
*/
|
|
49
|
+
uploadFile(caminho: string, conteudo: string | Buffer): Promise<void>;
|
|
36
50
|
execute(command: string, opts?: {
|
|
37
51
|
timeoutMs?: number;
|
|
38
52
|
}): Promise<import("./types.js").ExecuteResult>;
|
|
@@ -102,14 +116,10 @@ export interface InteractiveWrapOptions {
|
|
|
102
116
|
*
|
|
103
117
|
* `createSandboxBackend` resolve isto para o caminho não-interativo devolvendo um BACKEND pronto. O
|
|
104
118
|
* PTY não aceita um backend: ele é dono do spawn e só admite transformar o comando. Esta função
|
|
105
|
-
* entrega a MESMA decisão na forma que o PTY aceita — `(command, cwd) => string | null
|
|
106
|
-
* para `new PtyInteractiveBackend({ wrapCommand: interactiveWrapCommand({ mode }) })`.
|
|
119
|
+
* entrega a MESMA decisão na forma que o PTY aceita — `(command, cwd) => string | null`.
|
|
107
120
|
*
|
|
108
121
|
* A detecção é consultada **a cada wrap**, não congelada na construção: uma sessão interativa vive
|
|
109
122
|
* por horas, e uma detecção positiva obsoleta continuaria afirmando confinamento depois de o binário
|
|
110
|
-
* sumir
|
|
111
|
-
*
|
|
112
|
-
* As duas rotas que devolvem `null` são semanticamente diferentes e o código não as funde:
|
|
113
|
-
* `danger-full-access` é opt-out explícito e NÃO avisa; bwrap indisponível é falha e avisa uma vez.
|
|
123
|
+
* sumir.
|
|
114
124
|
*/
|
|
115
125
|
export declare function interactiveWrapCommand(opts: InteractiveWrapOptions): (command: string, cwd: string) => string | null;
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -332,6 +332,20 @@ export interface AgentOptions {
|
|
|
332
332
|
local?: LocalOptions;
|
|
333
333
|
cloud?: CloudOptions;
|
|
334
334
|
mcpServers?: Record<string, McpServerConfig>;
|
|
335
|
+
/**
|
|
336
|
+
* M77 — how long an MCP client lives.
|
|
337
|
+
*
|
|
338
|
+
* `'run'` (DEFAULT, and the historical behaviour) spawns a client per `send` and drops it when the
|
|
339
|
+
* run ends. `'session'` pools clients per `(agentId, server, config)` and keeps them across turns,
|
|
340
|
+
* which is what the reference does — Codex holds its connection manager in `SessionServices`
|
|
341
|
+
* (`core/src/state/service.rs:116`). Measured cost of the per-run path: 193 / 138 / 134 ms of
|
|
342
|
+
* spawn + handshake on every turn.
|
|
343
|
+
*
|
|
344
|
+
* Opt-in rather than default because it changes the FAILURE model: a server that dies mid-session
|
|
345
|
+
* becomes a reachable state. One-shot and cron runs gain nothing from pooling and would pay that
|
|
346
|
+
* risk, so they keep `'run'` unless they ask otherwise.
|
|
347
|
+
*/
|
|
348
|
+
mcpLifecycle?: "run" | "session";
|
|
335
349
|
agents?: Record<string, AgentDefinition>;
|
|
336
350
|
agentId?: string;
|
|
337
351
|
/** Context manager configuration. See `agent.context`. */
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
export type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunTripwireEvent | RunCompletionCheckEvent;
|
|
19
|
+
export type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunCompactionFallbackEvent | RunTripwireEvent | RunCompletionCheckEvent;
|
|
20
20
|
/**
|
|
21
21
|
* SE24 — a guardrail processor called `abort()`; the run stops with a tripwire.
|
|
22
22
|
* Delivered via {@link SendOptions.onRunEvent} (mirrors the `RunResult.tripwire`
|
|
@@ -91,6 +91,25 @@ export interface RunCompactBoundaryEvent {
|
|
|
91
91
|
/** Token count before compaction, when known. */
|
|
92
92
|
readonly preTokens?: number;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* M77 — auto-compaction is budgeting against a FLOOR, because neither the catalog nor the caller
|
|
96
|
+
* supplied a context window for this model.
|
|
97
|
+
*
|
|
98
|
+
* The prior behaviour was to disable auto-compaction entirely and write one line to stderr per
|
|
99
|
+
* process. That is fail-OPEN: the conversation grows until the provider rejects it. This event exists
|
|
100
|
+
* so a surface can say "I am running without a real budget" instead of the user discovering it at the
|
|
101
|
+
* moment of failure.
|
|
102
|
+
*
|
|
103
|
+
* Not emitted when the window came from the catalog (the normal path) or from an explicit caller
|
|
104
|
+
* override (the caller already knows).
|
|
105
|
+
*/
|
|
106
|
+
export interface RunCompactionFallbackEvent {
|
|
107
|
+
readonly type: "compaction_fallback";
|
|
108
|
+
/** The model whose window is unknown — what the user needs to fix in configuration. */
|
|
109
|
+
readonly model: string;
|
|
110
|
+
/** The floor being budgeted against, after the safety margin. */
|
|
111
|
+
readonly window: number;
|
|
112
|
+
}
|
|
94
113
|
/**
|
|
95
114
|
* SE2 — the opt-in sink for {@link RunEvent}s. Supplied via `SendOptions.onRunEvent`.
|
|
96
115
|
* Synchronous + best-effort: a throwing sink must never break the run (the emitter
|