@agentoryhq/runtime-contract 0.1.1 → 0.1.3

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 (2) hide show
  1. package/dist/index.d.ts +40 -1
  2. package/package.json +5 -4
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { AlignPatch, DiscoveredAgent, MemoryIndexReportItem, SessionIndexReportItem, TranscriptSnapshot } from "@agentoryhq/shared";
2
2
  /** Wire protocol version between Host and RuntimeAdapter implementations. */
3
3
  export declare const ADAPTER_API_VERSION: 1;
4
- export type AdapterCapability = "detect" | "discoverConfig" | "applyAlign" | "indexSessions" | "readTranscript" | "handoffExport";
4
+ export type AdapterCapability = "detect" | "discoverConfig" | "applyAlign" | "indexSessions" | "readTranscript" | "handoffExport" | "invoke";
5
5
  export type AdapterManifest = {
6
6
  /** Matches control-plane / shared RuntimeKind when known. */
7
7
  runtime: string;
@@ -25,11 +25,42 @@ export type ApplyAlignResult = {
25
25
  mcpPath: string;
26
26
  skillsPath: string;
27
27
  snapshotPath?: string;
28
+ /** 规则写盘目录(rules-desired-config,cursor-only;未写规则时缺省) */
29
+ rulesDir?: string;
30
+ /** 被覆盖规则文件的快照目录(rules-<ts>/;无覆盖时缺省) */
31
+ rulesSnapshotDir?: string;
28
32
  };
29
33
  export type AssetIndexResult = {
30
34
  sessions: SessionIndexReportItem[];
31
35
  memories: MemoryIndexReportItem[];
32
36
  };
37
+ /** Outcome of one headless execution requested via `invoke`. */
38
+ export type InvokeOutcome = "done" | "failed" | "timeout";
39
+ export type InvokeRequest = {
40
+ /** Task text sent to the runtime (单发单执行;一期不带上文). */
41
+ prompt: string;
42
+ /** Wall-clock execution budget; adapter MUST kill the process (group) on expiry. */
43
+ timeoutMs: number;
44
+ /** Cap on captured output; adapter truncates and sets `truncated`. */
45
+ maxOutputBytes: number;
46
+ /** Project directory the runtime executes in (Agent 实例根). */
47
+ cwd: string;
48
+ /** 二期预留(thread resume);一期调用方不得设置。 */
49
+ resumeSessionId?: string;
50
+ };
51
+ export type InvokeResult = {
52
+ outcome: InvokeOutcome;
53
+ /** Captured stdout+stderr, possibly truncated. Never contains secrets in plaintext. */
54
+ output: string;
55
+ truncated: boolean;
56
+ /** Process exit code; null when killed by signal (timeout) or not spawned. */
57
+ exitCode: number | null;
58
+ durationMs: number;
59
+ /** Runtime's own session id when obtainable; reserved for 二期 resume. */
60
+ runtimeSessionId?: string;
61
+ /** Short failure summary for `failed` / `timeout`. */
62
+ errorText?: string;
63
+ };
33
64
  /**
34
65
  * Per-runtime adapter. Host orchestrates; adapters own paths and formats.
35
66
  * Optional methods must match declared `capabilities`.
@@ -42,5 +73,13 @@ export type RuntimeAdapter = {
42
73
  indexSessions?(ctx: AdapterContext): AssetIndexResult;
43
74
  transcriptFileForSourceKey?(sourceKey: string, homeDir?: string): string | undefined;
44
75
  captureTranscriptSnapshot?(file: string, now?: Date): TranscriptSnapshot | undefined;
76
+ /**
77
+ * Execute one headless task (agent-messaging). Async on purpose: executions
78
+ * may run up to `timeoutMs` (~minutes) and MUST NOT block the daemon event
79
+ * loop — heartbeats keep flowing while a task runs.
80
+ * Red line (ADR-005): run with the runtime's DEFAULT permission model;
81
+ * never inject permission-relaxing flags (`--dangerously-skip-permissions` 类).
82
+ */
83
+ invoke?(ctx: AdapterContext, req: InvokeRequest): Promise<InvokeResult>;
45
84
  };
46
85
  export declare function hasCapability(manifest: AdapterManifest, cap: AdapterCapability): boolean;
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@agentoryhq/runtime-contract",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Agentory RuntimeAdapter contract (manifest + capabilities)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
- "files": ["dist"],
7
+ "files": [
8
+ "dist"
9
+ ],
8
10
  "exports": {
9
11
  ".": {
10
12
  "types": "./dist/index.d.ts",
@@ -19,8 +21,7 @@
19
21
  },
20
22
  "repository": {
21
23
  "type": "git",
22
- "url": "git+https://github.com/tunsuy/agentory-node.git",
23
- "directory": "packages/runtime-contract"
24
+ "url": "git+https://github.com/tunsuy/agentory-node.git"
24
25
  },
25
26
  "publishConfig": {
26
27
  "access": "public"