@springbrand/agent-runtime 0.2.0-alpha.72 → 0.3.0-alpha.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.
- package/package.json +3 -3
- package/src/{agent-tool-runtime.ts → adapter/cloudflare/agent-tool.ts} +1 -1
- package/src/adapter/cloudflare/agent.ts +1592 -0
- package/src/{db/index.ts → adapter/cloudflare/database.ts} +18 -55
- package/src/{runtime-agent.ts → adapter/cloudflare/define-agent.ts} +25 -35
- package/src/adapter/cloudflare/dynamic-worker-observability.ts +1 -1
- package/src/adapter/cloudflare/resources/runtime-resources.ts +4 -4
- package/src/adapter/cloudflare/sandbox/adapter.ts +1 -1
- package/src/{db → adapter/cloudflare}/schema.ts +16 -83
- package/src/adapter/cloudflare/subagent/definition.ts +63 -33
- package/src/adapter/cloudflare/subagent/runner.ts +174 -120
- package/src/adapter/cloudflare/subagent/tools.ts +13 -14
- package/src/adapter/cloudflare/universal-agent/preparation.ts +7 -7
- package/src/adapter/cloudflare/universal-agent/tools.ts +10 -10
- package/src/adapter/cloudflare/workspace/git-fs.ts +1 -1
- package/src/adapter/cloudflare/workspace/scoped-workspace.ts +1 -1
- package/src/adapter/cloudflare/workspace/version-control.ts +2 -2
- package/src/config/activation.ts +140 -0
- package/src/{runtime-agent-context.ts → config/agent-context.ts} +3 -3
- package/src/{runtime-assembler.ts → config/assembler.ts} +20 -19
- package/src/{kernel/runtime-assembly.ts → config/assembly-projection.ts} +4 -4
- package/src/{pi/assembly/snapshot.ts → config/assembly-snapshot.ts} +6 -6
- package/src/{runtime-definition.ts → config/definition.ts} +13 -13
- package/src/config/harness-runtime.ts +182 -0
- package/src/config/index.ts +14 -0
- package/src/{pi/runtime-adapter/assembly.ts → config/pinning.ts} +38 -16
- package/src/{kernel/bindings.ts → config/ports.ts} +9 -13
- package/src/{kernel → config}/profile.ts +7 -0
- package/src/{kernel → config}/public-contracts.ts +6 -6
- package/src/{kernel → config}/runtime-load.ts +1 -1
- package/src/{pi/assembly/context.ts → context/assembly.ts} +4 -206
- package/src/{pi/assembly/extensions.ts → context/extension/assembly.ts} +5 -5
- package/src/context/extension/index.ts +3 -0
- package/src/context/index.ts +6 -0
- package/src/{layers/context → context/memory}/budget/gate.ts +2 -2
- package/src/conversation/harness-resume.ts +288 -0
- package/src/conversation/harness-stream.ts +98 -0
- package/src/{pi/runtime-adapter/transcript.ts → conversation/history.ts} +206 -233
- package/src/conversation/index.ts +6 -0
- package/src/{pi → conversation}/message/contract.ts +3 -0
- package/src/{pi → conversation}/message/conversion.ts +75 -0
- package/src/{pi → conversation}/message/index.ts +1 -0
- package/src/{pi → conversation}/message/model-input.ts +1 -1
- package/src/{pi → conversation}/message/projection.ts +76 -10
- package/src/{db/message-ui.repo.ts → conversation/repository.ts} +4 -0
- package/src/conversation/state.ts +175 -0
- package/src/harness/index.ts +7 -0
- package/src/harness/session-harness.ts +481 -0
- package/src/harness/submission-operation.ts +49 -0
- package/src/index.ts +38 -43
- package/src/lib/mcp.ts +1 -1
- package/src/{pi/runtime-adapter/models.ts → models/index.ts} +64 -18
- package/src/{pi/turn/tool-recovery.ts → session/cloudflare/legacy-tool-recovery.ts} +33 -525
- package/src/{pi/session → session/cloudflare}/migration.ts +334 -8
- package/src/{pi/session → session/cloudflare}/storage.ts +8 -36
- package/src/session/index.ts +39 -0
- package/src/submission/admission.ts +275 -0
- package/src/{kernel/receipts.ts → submission/contracts.ts} +14 -0
- package/src/submission/delivery.ts +212 -0
- package/src/submission/finalization.ts +111 -0
- package/src/submission/index.ts +9 -0
- package/src/{kernel/submission-lifecycle.ts → submission/lifecycle.ts} +41 -28
- package/src/{db/submission.repo.ts → submission/repository.ts} +62 -119
- package/src/submission/steer-delivery.ts +167 -0
- package/src/{db/steer.repo.ts → submission/steer-repository.ts} +27 -5
- package/src/telemetry/contract.ts +12 -0
- package/src/telemetry/coordinator.ts +65 -0
- package/src/telemetry/delivery.ts +2 -2
- package/src/telemetry/index.ts +5 -0
- package/src/{model-usage.ts → telemetry/model-usage.ts} +1 -1
- package/src/telemetry/recorder.ts +1 -1
- package/src/telemetry/runtime-telemetry.ts +12 -0
- package/src/{kernel/durable-lifecycle.ts → telemetry/subagent-lifecycle.ts} +1 -1
- package/src/telemetry/turn-events.ts +279 -0
- package/src/{pi/tool → tools}/ai-adapter.ts +2 -2
- package/src/tools/approval/index.ts +1 -0
- package/src/{db/approval.repo.ts → tools/approval/repository.ts} +10 -30
- package/src/{pi/tool → tools}/base.ts +14 -30
- package/src/tools/compiler.ts +327 -0
- package/src/{pi/tool → tools}/core-host.ts +3 -3
- package/src/{pi/tool → tools}/core.ts +3 -3
- package/src/tools/decision-gate.ts +227 -0
- package/src/{pi/tool → tools}/gateway.ts +1 -1
- package/src/tools/human-decisions.ts +127 -0
- package/src/tools/index.ts +30 -0
- package/src/tools/interaction/index.ts +1 -0
- package/src/{pi/tool → tools}/mcp.ts +1 -1
- package/src/{pi/tool → tools}/schedule.ts +3 -3
- package/src/{pi/tool → tools}/skill.ts +4 -4
- package/src/{kernel → tools}/subagent-runtime.ts +1 -1
- package/src/{pi/tool → tools}/subagent.ts +4 -4
- package/src/tools/temporary-agent/approvals.ts +126 -0
- package/src/{layers/orchestration/temporary-agent/core.ts → tools/temporary-agent/coordinator.ts} +41 -49
- package/src/tools/temporary-agent/core.ts +53 -0
- package/src/{layers/orchestration → tools}/temporary-agent/runner.ts +1 -1
- package/src/{layers/orchestration → tools}/temporary-agent/workspace.ts +1 -1
- package/src/{pi/tool → tools}/web-search/api.ts +1 -1
- package/src/{pi/tool → tools}/workspace-revision.ts +2 -2
- package/src/{pi/tool → tools}/workspace-sandbox.ts +2 -2
- package/src/{pi/tool → tools}/workspace-state-connector.ts +1 -1
- package/src/db/milestone.repo.ts +0 -104
- package/src/db/settlement.repo.ts +0 -104
- package/src/kernel/approval-lifecycle.ts +0 -638
- package/src/kernel/interaction-lifecycle.ts +0 -433
- package/src/kernel/recoverable-chat-agent.ts +0 -1020
- package/src/kernel/state.ts +0 -91
- package/src/pi/assembly/index.ts +0 -19
- package/src/pi/runtime-adapter/execution.ts +0 -1163
- package/src/pi/runtime-adapter/index.ts +0 -293
- package/src/pi/runtime-adapter/recovery.ts +0 -982
- package/src/pi/session/index.ts +0 -24
- package/src/pi/tool/compiler.ts +0 -483
- package/src/pi/tool/index.ts +0 -38
- package/src/pi/turn/approval.ts +0 -181
- package/src/pi/turn/index.ts +0 -82
- package/src/pi/turn/interaction.ts +0 -181
- package/src/runtime.ts +0 -4760
- /package/src/{kernel/runtime-assembly-view.ts → config/assembly-view.ts} +0 -0
- /package/src/{kernel → config}/degradation.ts +0 -0
- /package/src/{kernel → config}/runtime-config.ts +0 -0
- /package/src/{kernel/extensions.ts → context/extension/contracts.ts} +0 -0
- /package/src/{db/ext-context.repo.ts → context/extension/repository.ts} +0 -0
- /package/src/{pi/runtime-adapter/openrouter-messages.ts → models/openrouter/messages.ts} +0 -0
- /package/src/{pi/runtime-adapter → models/openrouter}/test-fixtures/openrouter-tool-search.sse +0 -0
- /package/src/{db/submission-admission.repo.ts → submission/admission-repository.ts} +0 -0
- /package/src/{db/telemetry-outbox.repo.ts → telemetry/repository.ts} +0 -0
- /package/src/{db/runtime-event-outbox.repo.ts → telemetry/runtime-event-repository.ts} +0 -0
- /package/src/{pi/tool → tools}/declared.ts +0 -0
- /package/src/{db/interaction.repo.ts → tools/interaction/repository.ts} +0 -0
- /package/src/{pi/tool → tools}/nested-tools.ts +0 -0
- /package/src/{kernel/submission-authority.ts → tools/subagent-authority.ts} +0 -0
- /package/src/{db/agent-tool.repo.ts → tools/subagent-run-repository.ts} +0 -0
- /package/src/{layers/orchestration/subagents/agent-types → tools/subagent-types}/contract.ts +0 -0
- /package/src/{layers/orchestration/subagents/agent-types → tools/subagent-types}/extract/index.ts +0 -0
- /package/src/{layers/orchestration/subagents/agent-types → tools/subagent-types}/fanout/index.ts +0 -0
- /package/src/{layers/orchestration/subagents/agent-types → tools/subagent-types}/registry.ts +0 -0
- /package/src/{pi/tool → tools}/time.ts +0 -0
- /package/src/{pi/tool → tools}/web-fetch.ts +0 -0
- /package/src/{pi/tool → tools}/web-search/index.ts +0 -0
- /package/src/{pi/tool → tools}/web-search/web-search.ts +0 -0
- /package/src/{workspace-versioning.ts → tools/workspace-versioning.ts} +0 -0
package/src/kernel/state.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { ApprovalReceipt } from "./receipts";
|
|
2
|
-
|
|
3
|
-
export type RuntimeLoadPhase = "config" | "assembly" | "mcp" | "pi";
|
|
4
|
-
|
|
5
|
-
export type RuntimeActivity = "idle" | "working" | "needs-input";
|
|
6
|
-
|
|
7
|
-
export interface RuntimeActivityProjection {
|
|
8
|
-
activity: RuntimeActivity;
|
|
9
|
-
/**
|
|
10
|
-
* 是否仍有 Agent Tool 子运行在执行。
|
|
11
|
-
*
|
|
12
|
-
* `activity` 三态互斥,表达不了「等人回应的同时后台还在跑」。Host 的列表需要
|
|
13
|
-
* 这两件事各自成立,所以它是一个独立维度,而不是第四种活动值。
|
|
14
|
-
*/
|
|
15
|
-
backgroundWork: boolean;
|
|
16
|
-
revision: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Runtime 最近一次装载尝试的公开状态。
|
|
21
|
-
*
|
|
22
|
-
* `available` 与本次尝试分开表达:强制重载失败时,旧 Runtime 仍可能继续服务。
|
|
23
|
-
* 该状态由 Agents SDK 的 Agent state 同步给浏览器,不包含底层异常文本。
|
|
24
|
-
*/
|
|
25
|
-
export type RuntimeLoadState =
|
|
26
|
-
| {
|
|
27
|
-
status: "idle";
|
|
28
|
-
available: false;
|
|
29
|
-
}
|
|
30
|
-
| {
|
|
31
|
-
status: "loading";
|
|
32
|
-
phase: RuntimeLoadPhase;
|
|
33
|
-
available: boolean;
|
|
34
|
-
startedAt: number;
|
|
35
|
-
updatedAt: number;
|
|
36
|
-
}
|
|
37
|
-
| {
|
|
38
|
-
status: "ready";
|
|
39
|
-
available: true;
|
|
40
|
-
startedAt: number;
|
|
41
|
-
completedAt: number;
|
|
42
|
-
}
|
|
43
|
-
| {
|
|
44
|
-
status: "error";
|
|
45
|
-
phase: RuntimeLoadPhase;
|
|
46
|
-
available: boolean;
|
|
47
|
-
startedAt: number;
|
|
48
|
-
failedAt: number;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export interface RuntimeQueuedSubmission {
|
|
52
|
-
submissionId: string;
|
|
53
|
-
messageId: string;
|
|
54
|
-
preview: string;
|
|
55
|
-
position: number;
|
|
56
|
-
createdAt: number;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface RuntimeTurnState {
|
|
60
|
-
activeSubmissionId?: string;
|
|
61
|
-
activeRequestId?: string;
|
|
62
|
-
activeMessageId?: string;
|
|
63
|
-
recoveryAttempt?: number;
|
|
64
|
-
recoveryMax?: number;
|
|
65
|
-
recoveryReason?:
|
|
66
|
-
| "no_meaningful_model_progress"
|
|
67
|
-
| "server_tool_timeout"
|
|
68
|
-
| "transient_model_error";
|
|
69
|
-
steerable: boolean;
|
|
70
|
-
hasPendingSteer: boolean;
|
|
71
|
-
queued: RuntimeQueuedSubmission[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* 保存 Kernel 在当前会话里自己维护的审批状态。
|
|
76
|
-
*
|
|
77
|
-
* @remarks
|
|
78
|
-
* `RuntimeAgent` 把它作为 Agent state 的形状,并在审批记录变化时读写。
|
|
79
|
-
*
|
|
80
|
-
* 它故意不保存用户、Agent 或 Session 等业务身份,避免 Runtime 越过 Host 的归属边界。
|
|
81
|
-
*
|
|
82
|
-
* `Runtime`、`Kernel` 与 `Host` 等核心术语见 `../index.ts`。
|
|
83
|
-
*/
|
|
84
|
-
export interface RuntimeState {
|
|
85
|
-
/** 当前实例的 Runtime 装载状态;旧状态记录没有该字段时等同 `idle`。 */
|
|
86
|
-
runtimeLoad?: RuntimeLoadState;
|
|
87
|
-
/** 供 Host 列表持久化的粗粒度活动状态;Submission 与 Approval 仍是执行真相。 */
|
|
88
|
-
activity?: RuntimeActivityProjection;
|
|
89
|
-
approvals?: ApprovalReceipt[];
|
|
90
|
-
turn?: RuntimeTurnState;
|
|
91
|
-
}
|
package/src/pi/assembly/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assemblePiSystemContext,
|
|
3
|
-
compactPiContext,
|
|
4
|
-
} from "./context";
|
|
5
|
-
import {
|
|
6
|
-
assemblePiExtensions,
|
|
7
|
-
loadPiExtension,
|
|
8
|
-
} from "./extensions";
|
|
9
|
-
|
|
10
|
-
export const piAssembly = Object.freeze({
|
|
11
|
-
assembleContext: assemblePiSystemContext,
|
|
12
|
-
compactContext: compactPiContext,
|
|
13
|
-
assembleExtensions: assemblePiExtensions,
|
|
14
|
-
loadExtension: loadPiExtension,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export * from "./context";
|
|
18
|
-
export * from "./extensions";
|
|
19
|
-
export * from "./snapshot";
|