@mininglamp-oss/octo-runtime 1.0.0 → 1.0.1

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 (101) hide show
  1. package/apps/cli/dist/build-info.json +3 -2
  2. package/apps/cli/dist/help.js +15 -6
  3. package/apps/cli/dist/state.d.ts +1 -0
  4. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.d.ts +4 -1
  5. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +14 -7
  6. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  7. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +2 -2
  8. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +5 -4
  9. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  10. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +3 -3
  11. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.js +5 -1
  12. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  13. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +2 -1
  14. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  15. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +3 -3
  16. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +3 -2
  17. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  18. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +19 -6
  19. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  20. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +1 -1
  21. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  22. package/node_modules/@mininglamp-oss/octo-runtime-adapter-host/dist/host-run-service.d.ts +2 -1
  23. package/node_modules/@mininglamp-oss/octo-runtime-adapter-host/dist/host-run-service.js +29 -11
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-host/dist/index.js +45 -17
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-host/dist/rpc.d.ts +2 -1
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-host/dist/rpc.js +90 -18
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-host/dist/runtime-configuration.js +32 -1
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-host/dist/socket-server.js +6 -1
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-host/package.json +16 -16
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +1 -1
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +1 -1
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +2 -0
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +4 -4
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +1 -1
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +1 -1
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +1 -1
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +2 -1
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +3 -1
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +5 -3
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/line-limit.js +15 -4
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/native.d.ts +4 -1
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/native.js +29 -4
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/app-server.d.ts +1 -1
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/app-server.js +17 -11
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  52. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +3 -2
  53. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +15 -6
  54. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.d.ts +1 -0
  55. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +8 -8
  56. package/node_modules/@mininglamp-oss/octo-runtime-core/package.json +2 -2
  57. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  58. package/node_modules/@mininglamp-oss/octo-runtime-daemon/dist/runtime/run-stream.js +29 -12
  59. package/node_modules/@mininglamp-oss/octo-runtime-daemon/dist/server.js +7 -1
  60. package/node_modules/@mininglamp-oss/octo-runtime-daemon/package.json +17 -17
  61. package/node_modules/@mininglamp-oss/octo-runtime-daemon-app/package.json +7 -7
  62. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.d.ts +34 -0
  63. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.js +124 -0
  64. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +152 -9
  65. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +4 -0
  66. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.js +32 -0
  67. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +16 -0
  68. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +54 -4
  69. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.js +4 -1
  70. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.d.ts +5 -0
  71. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +8 -2
  72. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +49 -2
  73. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.d.ts +4 -1
  74. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +94 -15
  75. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.d.ts +1 -0
  76. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.js +10 -5
  77. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.js +5 -1
  78. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +19 -2
  79. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +30 -4
  80. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +7 -7
  81. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +3 -2
  82. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +6 -6
  83. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-DiPc-ipL.js +74 -0
  84. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
  85. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  86. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +4 -0
  87. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +30 -1
  88. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +2 -1
  89. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +1 -0
  90. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +1 -0
  91. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +3 -0
  92. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-size.js +2 -1
  93. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +1 -1
  94. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +51 -4
  95. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/stream-limits.d.ts +27 -0
  96. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/stream-limits.js +56 -0
  97. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  98. package/node_modules/ws/lib/websocket.js +17 -3
  99. package/node_modules/ws/package.json +1 -1
  100. package/package.json +27 -27
  101. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-B6Yp4xkI.js +0 -76
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-qoderclicn",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,6 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.0.0"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.0.1"
13
13
  }
14
14
  }
@@ -1,4 +1,4 @@
1
- import type { ProtocolMode } from "@mininglamp-oss/octo-runtime-protocol";
1
+ import type { ProtocolMode, StreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  /** Provider progress used by the host watchdog to enforce execution deadlines. */
3
3
  export interface ProviderActivity {
4
4
  kind: "turn_started" | "turn_progress" | "transport_response" | "retry_notice";
@@ -8,6 +8,7 @@ export interface ProviderActivity {
8
8
  }
9
9
  export interface AdapterInvocationContext {
10
10
  protocolMode?: ProtocolMode;
11
+ streamLimits?: Readonly<StreamLimitPolicy>;
11
12
  reportConversion?(): void;
12
13
  reportActivity?(activity: ProviderActivity): void;
13
14
  }
@@ -4,7 +4,7 @@ export type { AdapterInvocationContext, ProviderActivity } from "./activity.js";
4
4
  export { invocationEnvironment, invocationEnvs } from "./environment.js";
5
5
  export { invocationMcpServers, expandMcpValue, assertMcpOptions } from "./mcp.js";
6
6
  export { actmodeEvidence } from "./actmode.js";
7
- import { type CanonicalEvent, type AdapterProtocolSupport, type HostControl, type NativeHostFrame, type InvokeRequest } from "@mininglamp-oss/octo-runtime-protocol";
7
+ import { type CanonicalEvent, type AdapterProtocolSupport, type HostControl, type NativeHostFrame, type InvokeRequest, type StreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
8
8
  export { freshFallbackInputText, initialControlInstructions, hasImageInput, providerInputParts, providerInputText } from "@mininglamp-oss/octo-runtime-protocol";
9
9
  export type { CanonicalEvent, InvokeRequest, MessageChannel, MessageExposure, MessageProvenance } from "@mininglamp-oss/octo-runtime-protocol";
10
10
  export { acpToolTerminalStatus, normalizeAcpToolUpdate } from "./acp-tool.js";
@@ -31,6 +31,7 @@ export interface AdapterMetadata {
31
31
  /** Trusted local connection settings; never sourced from model Context. */
32
32
  export interface AdapterProbeOptions {
33
33
  providerOptions?: Record<string, string>;
34
+ streamLimits?: StreamLimitPolicy;
34
35
  }
35
36
  export interface ProbeResult {
36
37
  available: boolean;
@@ -75,6 +76,7 @@ interface SpawnJsonLinesOptions<TNative> extends CommandSpec {
75
76
  controlHandler?: (event: TNative, write: (response: unknown) => Promise<void>) => Promise<void>;
76
77
  endInputWhen?: (event: TNative) => boolean;
77
78
  onSpawn?: (close: () => Promise<void>) => void;
79
+ rawMessageMaxBytes?: number;
78
80
  }
79
81
  interface ProcessExit {
80
82
  code: number | null;
@@ -11,7 +11,7 @@ import { mapReasoningEffort, reasoningLevelMap } from "./reasoning.js";
11
11
  export { invocationEnvironment, invocationEnvs } from "./environment.js";
12
12
  export { invocationMcpServers, expandMcpValue, assertMcpOptions } from "./mcp.js";
13
13
  export { actmodeEvidence } from "./actmode.js";
14
- import { isTerminal, assertProtocolSupport } from "@mininglamp-oss/octo-runtime-protocol";
14
+ import { DEFAULT_STREAM_LIMIT_POLICY, isTerminal, assertProtocolSupport } from "@mininglamp-oss/octo-runtime-protocol";
15
15
  export { freshFallbackInputText, initialControlInstructions, hasImageInput, providerInputParts, providerInputText } from "@mininglamp-oss/octo-runtime-protocol";
16
16
  export { acpToolTerminalStatus, normalizeAcpToolUpdate } from "./acp-tool.js";
17
17
  export { AcpTurnNormalizer } from "./acp-turn.js";
@@ -119,7 +119,8 @@ export async function* spawnJsonLines(options) {
119
119
  // would incorrectly classify a synchronous write failure as dispatched.
120
120
  let controlError;
121
121
  const reader = createInterface({ input: child.stdout });
122
- const removeLineGuard = watchLineLimit(child.stdout, 256 * 1024, (error) => {
122
+ const removeLineGuard = watchLineLimit(child.stdout, options.rawMessageMaxBytes ?? DEFAULT_STREAM_LIMIT_POLICY.rawMessageMaxBytes, (error) => {
123
+ Object.assign(error, { boundary: "provider.stdout" });
123
124
  controlError ??= error;
124
125
  reader.close();
125
126
  child.stdout.destroy();
@@ -204,7 +205,7 @@ export function createJsonCliAdapter(options) {
204
205
  return defineAdapter({
205
206
  metadata,
206
207
  ...(probe ? { probe } : {}),
207
- async *invoke(request) {
208
+ async *invoke(request, context) {
208
209
  const spec = await buildCommand(request);
209
210
  let terminal = false;
210
211
  try {
@@ -218,6 +219,7 @@ export function createJsonCliAdapter(options) {
218
219
  cwd: spec.cwd ?? request.workdir,
219
220
  env: invocationEnvironment(request, spec.env),
220
221
  signal: request.signal,
222
+ rawMessageMaxBytes: context?.streamLimits?.rawMessageMaxBytes,
221
223
  parseLine: parseJsonLine
222
224
  })) {
223
225
  const events = normalize(native, request) ?? [];
@@ -1,3 +1,4 @@
1
+ import { streamCapacityError } from "@mininglamp-oss/octo-runtime-protocol";
1
2
  /** Guard readline's partial-line buffer before it allocates an unbounded record. */
2
3
  export function watchLineLimit(input, maximum, fail) {
3
4
  let bytes = 0, failed = false;
@@ -8,18 +9,28 @@ export function watchLineLimit(input, maximum, fail) {
8
9
  let start = 0;
9
10
  for (let end = buffer.indexOf(10); end >= 0; end = buffer.indexOf(10, start)) {
10
11
  bytes += end - start;
11
- if (bytes > (typeof maximum === "function" ? maximum() : maximum)) {
12
+ const limit = typeof maximum === "function" ? maximum() : maximum;
13
+ if (bytes > limit) {
12
14
  failed = true;
13
- fail(Object.assign(new Error("STREAM_EVENT_TOO_LARGE"), { code: "STREAM_EVENT_TOO_LARGE" }));
15
+ fail(streamCapacityError("PROVIDER_MESSAGE_TOO_LARGE", {
16
+ boundary: "provider.line",
17
+ measuredBytes: bytes,
18
+ limitBytes: limit
19
+ }));
14
20
  return;
15
21
  }
16
22
  bytes = 0;
17
23
  start = end + 1;
18
24
  }
19
25
  bytes += buffer.byteLength - start;
20
- if (bytes > (typeof maximum === "function" ? maximum() : maximum)) {
26
+ const limit = typeof maximum === "function" ? maximum() : maximum;
27
+ if (bytes > limit) {
21
28
  failed = true;
22
- fail(Object.assign(new Error("STREAM_EVENT_TOO_LARGE"), { code: "STREAM_EVENT_TOO_LARGE" }));
29
+ fail(streamCapacityError("PROVIDER_MESSAGE_TOO_LARGE", {
30
+ boundary: "provider.line",
31
+ measuredBytes: bytes,
32
+ limitBytes: limit
33
+ }));
23
34
  }
24
35
  };
25
36
  input.prependListener("data", observe);
@@ -1,4 +1,4 @@
1
- import { type NativeInteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
1
+ import { type StreamLimitPolicy, type NativeInteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  import type { AdapterOutput } from "./index.js";
3
3
  /** Bounded queue for provider callbacks; overflow fails the owning invocation. */
4
4
  export declare class DriverQueue<T> implements AsyncIterable<T> {
@@ -7,6 +7,8 @@ export declare class DriverQueue<T> implements AsyncIterable<T> {
7
7
  constructor(options?: {
8
8
  discardOnFailure?: boolean;
9
9
  onFailure?: (error: Error) => void;
10
+ limits?: Pick<StreamLimitPolicy, "adapterQueueItemMaxBytes" | "adapterQueueMaxBytes" | "adapterQueueMaxItems">;
11
+ boundary?: string;
10
12
  });
11
13
  push(value: T): void;
12
14
  close(error?: Error): void;
@@ -18,6 +20,7 @@ export declare class DriverQueue<T> implements AsyncIterable<T> {
18
20
  export declare class NativeInteractionBridge {
19
21
  #private;
20
22
  readonly queue: DriverQueue<AdapterOutput>;
23
+ constructor(limits?: Readonly<StreamLimitPolicy>);
21
24
  bindTransport(close: () => Promise<void>): void;
22
25
  request(requestId: string | number, payload: Record<string, unknown>, write: (payload: unknown) => Promise<void>, validate: (payload: Record<string, unknown>) => void, automatic?: Record<string, unknown>): void;
23
26
  respond(response: NativeInteractionResponse): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { protocolError } from "@mininglamp-oss/octo-runtime-protocol";
1
+ import { DEFAULT_STREAM_LIMIT_POLICY, protocolError, streamCapacityError } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  /** Bounded queue for provider callbacks; overflow fails the owning invocation. */
3
3
  export class DriverQueue {
4
4
  options;
@@ -14,8 +14,30 @@ export class DriverQueue {
14
14
  if (this.#closed)
15
15
  return;
16
16
  const bytes = Buffer.byteLength(JSON.stringify(value));
17
- if (bytes > 256 * 1024 || this.#items.length >= 4096 || this.#bytes + bytes > 4 * 1024 * 1024) {
18
- this.close(Object.assign(new Error("STREAM_BUFFER_OVERFLOW"), { code: "STREAM_BUFFER_OVERFLOW" }));
17
+ const limits = this.options.limits ?? DEFAULT_STREAM_LIMIT_POLICY;
18
+ const boundary = this.options.boundary ?? "adapter.output_queue";
19
+ if (bytes > limits.adapterQueueItemMaxBytes) {
20
+ this.close(streamCapacityError("STREAM_QUEUE_ITEM_TOO_LARGE", {
21
+ boundary,
22
+ measuredBytes: bytes,
23
+ limitBytes: limits.adapterQueueItemMaxBytes
24
+ }));
25
+ return;
26
+ }
27
+ if (this.#items.length >= limits.adapterQueueMaxItems) {
28
+ this.close(streamCapacityError("STREAM_QUEUE_ITEMS_EXCEEDED", {
29
+ boundary,
30
+ itemCount: this.#items.length + 1,
31
+ limitItems: limits.adapterQueueMaxItems
32
+ }));
33
+ return;
34
+ }
35
+ if (this.#bytes + bytes > limits.adapterQueueMaxBytes) {
36
+ this.close(streamCapacityError("STREAM_QUEUE_BYTES_EXCEEDED", {
37
+ boundary,
38
+ measuredBytes: this.#bytes + bytes,
39
+ limitBytes: limits.adapterQueueMaxBytes
40
+ }));
19
41
  return;
20
42
  }
21
43
  if (this.#waiter) {
@@ -75,11 +97,14 @@ export class DriverQueue {
75
97
  }
76
98
  /** Owns raw reverse requests, acknowledged replies, expiry and teardown for one turn. */
77
99
  export class NativeInteractionBridge {
78
- queue = new DriverQueue();
100
+ queue;
79
101
  #pending = new Map();
80
102
  #closed = false;
81
103
  #closeTransport;
82
104
  #seen = new Set();
105
+ constructor(limits) {
106
+ this.queue = new DriverQueue({ limits, boundary: "adapter.native_queue" });
107
+ }
83
108
  bindTransport(close) {
84
109
  this.#closeTransport = close;
85
110
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -8,7 +8,7 @@
8
8
  "./process-cleanup": "./dist/process-cleanup.js"
9
9
  },
10
10
  "dependencies": {
11
- "@mininglamp-oss/octo-runtime-protocol": "1.0.0"
11
+ "@mininglamp-oss/octo-runtime-protocol": "1.0.1"
12
12
  },
13
13
  "types": "./dist/index.d.ts",
14
14
  "files": [
@@ -53,7 +53,7 @@ export declare class ZcodeEventNormalizer {
53
53
  normalize(event: ZcodeSessionEvent): CanonicalEvent[];
54
54
  }
55
55
  export declare function normalizeZcodeEvent(event: ZcodeSessionEvent, state: NormalizerState): CanonicalEvent[];
56
- export declare function runZcodeAppServerTurn({ request, spec, spawnFn, approvalBridge }: {
56
+ export declare function runZcodeAppServerTurn({ request, spec, spawnFn, context, approvalBridge }: {
57
57
  request: InvokeRequest;
58
58
  spec: ZcodeAppServerCommand;
59
59
  context?: AdapterInvocationContext;
@@ -1,6 +1,6 @@
1
1
  import { createProcessCleanup } from "@mininglamp-oss/octo-runtime-adapter-sdk/process-cleanup";
2
2
  import { DriverQueue, watchLineLimit, initialControlInstructions, hasImageInput, freshFallbackInputText, providerInputText } from "@mininglamp-oss/octo-runtime-adapter-sdk";
3
- import { canonicalTerminalStatus } from "@mininglamp-oss/octo-runtime-protocol";
3
+ import { canonicalTerminalStatus, resolveStreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
4
4
  import { spawn } from "node:child_process";
5
5
  import { createInterface } from "node:readline";
6
6
  const REQUEST_TIMEOUT_MS = 30_000;
@@ -322,7 +322,7 @@ export function normalizeZcodeEvent(event, state) {
322
322
  }
323
323
  return events;
324
324
  }
325
- export async function* runZcodeAppServerTurn({ request, spec, spawnFn = defaultSpawn, approvalBridge }) {
325
+ export async function* runZcodeAppServerTurn({ request, spec, spawnFn = defaultSpawn, context, approvalBridge }) {
326
326
  if (hasImageInput(request))
327
327
  throw new Error("UNSUPPORTED_INPUT_MODALITY: zcode-gui does not encode image input");
328
328
  if (request.approvalMode === "assisted" || (request.approvalMode === "ask" && !approvalBridge))
@@ -335,6 +335,7 @@ export async function* runZcodeAppServerTurn({ request, spec, spawnFn = defaultS
335
335
  spawnFn,
336
336
  requestTimeoutMs: requestTimeout(request),
337
337
  autoApprove,
338
+ streamLimits: context?.streamLimits,
338
339
  permissionHandler: approvalBridge
339
340
  ? async (params, write) => {
340
341
  const permission = {
@@ -485,9 +486,8 @@ export async function* runZcodeAppServerTurn({ request, spec, spawnFn = defaultS
485
486
  class ZcodeAppServerClient {
486
487
  #child;
487
488
  #pending = new Map();
488
- #events = new DriverQueue({
489
- onFailure: (error) => this.#failAll(error)
490
- });
489
+ #events;
490
+ #streamLimits;
491
491
  #requestTimeoutMs;
492
492
  #autoApprove;
493
493
  #permissionHandler;
@@ -503,7 +503,13 @@ class ZcodeAppServerClient {
503
503
  #closePromise;
504
504
  #failure;
505
505
  #removeLineGuard;
506
- constructor({ spec, spawnFn, requestTimeoutMs, autoApprove, permissionHandler }) {
506
+ constructor({ spec, spawnFn, requestTimeoutMs, autoApprove, streamLimits, permissionHandler }) {
507
+ this.#streamLimits = resolveStreamLimitPolicy(streamLimits);
508
+ this.#events = new DriverQueue({
509
+ limits: this.#streamLimits,
510
+ boundary: "zcode.event_queue",
511
+ onFailure: (error) => this.#failAll(error)
512
+ });
507
513
  this.#requestTimeoutMs = requestTimeoutMs;
508
514
  this.#autoApprove = autoApprove;
509
515
  this.#permissionHandler = permissionHandler;
@@ -525,9 +531,10 @@ class ZcodeAppServerClient {
525
531
  for (const source of [this.#child.stdin, this.#child.stdout, this.#child.stderr]) {
526
532
  source.on("error", (error) => this.#failAll(error));
527
533
  }
528
- // S04:ZCode 不支持图片输入,所有原生行按普通 256 KiB 上限控制。
534
+ // ZCode 不支持图片输入,所有原生行使用本 invocation 的 Provider 上限。
529
535
  // .octospec/tasks/pr1-yujiawei-review/assessment.md
530
- this.#removeLineGuard = watchLineLimit(this.#child.stdout, 256 * 1024, (error) => {
536
+ this.#removeLineGuard = watchLineLimit(this.#child.stdout, this.#streamLimits.rawMessageMaxBytes, (error) => {
537
+ Object.assign(error, { boundary: "zcode.stdout" });
531
538
  this.#failAll(error);
532
539
  this.#child.stdout.destroy();
533
540
  });
@@ -768,9 +775,8 @@ function failureReason(error) {
768
775
  return "session_resume_failed";
769
776
  }
770
777
  function errorCode(error) {
771
- if (error instanceof Error &&
772
- ["STREAM_BUFFER_OVERFLOW", "STREAM_EVENT_TOO_LARGE"].includes(error.message))
773
- return error.message;
778
+ if (error instanceof Error && "code" in error && typeof error.code === "string")
779
+ return error.code;
774
780
  if (error instanceof ZcodeAppServerRpcError)
775
781
  return error.code;
776
782
  if (error instanceof ZcodeAppServerProcessError)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-zcode-gui",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "dependencies": {
8
- "@mininglamp-oss/octo-runtime-protocol": "1.0.0",
9
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.0.0"
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.0.1",
9
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.0.1"
10
10
  },
11
11
  "types": "./dist/index.d.ts",
12
12
  "files": [
@@ -1,4 +1,5 @@
1
1
  {
2
- "commit": "62d10ac46e7c2c3505b42c362229f7b91f328e5b",
3
- "dirty": false
2
+ "commit": "1505ce132bb0ae98afc3229a6eac6a7507849883",
3
+ "dirty": false,
4
+ "buildTime": "2026-10-19T08:39:57.478Z"
4
5
  }
@@ -3,16 +3,25 @@ import { fileURLToPath } from "node:url";
3
3
  // Read the public release package, rather than the private CLI workspace version.
4
4
  const releasePackage = JSON.parse(readFileSync(new URL("../../../package.json", import.meta.url), "utf8"));
5
5
  export const cliVersion = releasePackage.version;
6
- let buildInfo = { commit: null, dirty: null };
6
+ let buildInfo = {};
7
7
  try {
8
- buildInfo = JSON.parse(readFileSync(new URL("./build-info.json", import.meta.url), "utf8"));
8
+ const metadata = JSON.parse(readFileSync(new URL("./build-info.json", import.meta.url), "utf8"));
9
+ if (metadata !== null && typeof metadata === "object")
10
+ buildInfo = metadata;
9
11
  }
10
12
  catch (error) {
11
- if (error.code !== "ENOENT")
13
+ if (!(error instanceof SyntaxError) && error.code !== "ENOENT")
12
14
  throw error;
13
15
  }
14
- const cliCommitInfo = `commit:${buildInfo.commit?.slice(0, 12) ?? "unknown"}${buildInfo.dirty ? " (dirty)" : ""}`;
15
- export const cliVersionInfo = `${cliVersion}\n${cliCommitInfo}`;
16
+ const cliCommitInfo = `commit:${typeof buildInfo.commit === "string" ? buildInfo.commit.slice(0, 12) : "unknown"}${buildInfo.dirty === true ? " (dirty)" : ""}`;
17
+ const buildTime = buildInfo.buildTime;
18
+ const validBuildTime = typeof buildTime === "string" &&
19
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/.test(buildTime) &&
20
+ Number.isFinite(Date.parse(buildTime)) &&
21
+ new Date(buildTime).toISOString() ===
22
+ (buildTime.includes(".") ? buildTime : buildTime.replace("Z", ".000Z"));
23
+ const cliBuildInfo = `build:${validBuildTime ? buildTime : "unknown"}`;
24
+ export const cliVersionInfo = `${cliVersion}\n${cliCommitInfo}\n${cliBuildInfo}`;
16
25
  const commands = {
17
26
  description: "Manage the local Agent runtime, provider adapters, and background service.\nBuilt-in adapters work by default; no adapter configuration is required.",
18
27
  children: {
@@ -108,7 +117,7 @@ export function helpText(path = []) {
108
117
  const command = commandAt(path);
109
118
  const invocation = ["octo-runtime", ...path].join(" ");
110
119
  const sections = [
111
- ...(path.length ? [] : [`Octo Runtime CLI (${cliVersion})\n${cliCommitInfo}`]),
120
+ ...(path.length ? [] : [`Octo Runtime CLI (${cliVersion})\n${cliCommitInfo}\n${cliBuildInfo}`]),
112
121
  command.description,
113
122
  ...(command.details ? [command.details] : []),
114
123
  `Usage:\n ${invocation}${command.children ? " [command]" : command.usage ? ` ${command.usage}` : ""} [flags]`,
@@ -16,6 +16,7 @@ export interface ProfileConfiguration {
16
16
  execution: {
17
17
  provider_options: Record<string, string>;
18
18
  credential_ref?: string;
19
+ stream_limits?: Record<string, number>;
19
20
  };
20
21
  }>;
21
22
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,12 +8,12 @@
8
8
  },
9
9
  "types": "./dist/index.d.ts",
10
10
  "dependencies": {
11
- "@mininglamp-oss/octo-runtime-daemon": "1.0.0",
12
- "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.0.0",
13
- "@mininglamp-oss/octo-runtime-cross-service": "1.0.0",
14
- "@mininglamp-oss/octo-runtime-daemon-app": "1.0.0",
15
- "@mininglamp-oss/octo-runtime-protocol": "1.0.0",
16
- "@mininglamp-oss/octo-runtime-adapter-host": "1.0.0",
17
- "@mininglamp-oss/octo-runtime-core": "1.0.0"
11
+ "@mininglamp-oss/octo-runtime-daemon": "1.0.1",
12
+ "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.0.1",
13
+ "@mininglamp-oss/octo-runtime-cross-service": "1.0.1",
14
+ "@mininglamp-oss/octo-runtime-daemon-app": "1.0.1",
15
+ "@mininglamp-oss/octo-runtime-protocol": "1.0.1",
16
+ "@mininglamp-oss/octo-runtime-adapter-host": "1.0.1",
17
+ "@mininglamp-oss/octo-runtime-core": "1.0.1"
18
18
  }
19
19
  }
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "dependencies": {
8
- "@mininglamp-oss/octo-runtime-protocol": "1.0.0"
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.0.1"
9
9
  },
10
10
  "types": "./dist/index.d.ts",
11
11
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-cross-service",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "description": "Native user-service lifecycle backends for Octo Runtime",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  import { createConnection } from "node:net";
2
2
  import { randomUUID } from "node:crypto";
3
- import { assertHostFrameIdentity, assertHostRunReceipt, isHostTerminal, identifyInvokeInput, assertJsonByteLimit, INVOKE_REQUEST_MAX_BYTES } from "@mininglamp-oss/octo-runtime-protocol";
3
+ import { assertHostFrameIdentity, assertHostRunReceipt, isHostTerminal, identifyInvokeInput, assertJsonByteLimit, INVOKE_REQUEST_MAX_BYTES, HOST_RPC_MAX_LINE_BYTES, streamCapacityError } from "@mininglamp-oss/octo-runtime-protocol";
4
4
  import { callDaemon } from "./runtime-contract.js";
5
5
  /** Local source notifications have no per-event ACK and allocate no durable consumer queue. */
6
6
  export async function* subscribeDaemonRun(socketPath, input) {
@@ -27,16 +27,29 @@ export async function* subscribeDaemonRun(socketPath, input) {
27
27
  socket.setEncoding("utf8");
28
28
  socket.setTimeout(5000, () => socket.destroy(new Error("HOST_STREAM_HANDSHAKE_TIMEOUT")));
29
29
  socket.write(`${JSON.stringify(wireRequest)}\n`);
30
- let pending = "", started = false;
30
+ let pending = [];
31
+ let pendingBytes = 0, started = false;
32
+ const assertLineBytes = (measuredBytes) => {
33
+ if (measuredBytes > HOST_RPC_MAX_LINE_BYTES)
34
+ throw streamCapacityError("HOST_FRAME_TOO_LARGE", {
35
+ boundary: "daemon.stream_transport",
36
+ measuredBytes,
37
+ limitBytes: HOST_RPC_MAX_LINE_BYTES
38
+ });
39
+ };
31
40
  try {
32
41
  for await (const chunk of socket) {
33
- pending += String(chunk);
34
- let boundary = pending.indexOf("\n");
42
+ const text = String(chunk);
43
+ let start = 0;
44
+ let boundary = text.indexOf("\n");
35
45
  while (boundary >= 0) {
36
- const line = pending.slice(0, boundary);
37
- pending = pending.slice(boundary + 1);
38
- if (line.length > 512 * 1024)
39
- throw new Error("HOST_STREAM_FRAME_TOO_LARGE");
46
+ const segment = text.slice(start, boundary);
47
+ pending.push(segment);
48
+ pendingBytes += Buffer.byteLength(segment, "utf8");
49
+ assertLineBytes(pendingBytes);
50
+ const line = pending.join("");
51
+ pending = [];
52
+ pendingBytes = 0;
40
53
  const frame = JSON.parse(line);
41
54
  if (frame.jsonrpc !== "2.0")
42
55
  throw new Error("HOST_STREAM_PROTOCOL_INVALID");
@@ -51,12 +64,16 @@ export async function* subscribeDaemonRun(socketPath, input) {
51
64
  yield frame;
52
65
  if (input.signal?.aborted)
53
66
  return;
54
- boundary = pending.indexOf("\n");
67
+ start = boundary + 1;
68
+ boundary = text.indexOf("\n", start);
55
69
  }
56
- if (pending.length > 512 * 1024)
57
- throw new Error("HOST_STREAM_FRAME_TOO_LARGE");
70
+ const remainder = text.slice(start);
71
+ if (remainder)
72
+ pending.push(remainder);
73
+ pendingBytes += Buffer.byteLength(remainder, "utf8");
74
+ assertLineBytes(pendingBytes);
58
75
  }
59
- if (!input.signal?.aborted && (!started || pending.trim()))
76
+ if (!input.signal?.aborted && (!started || pending.some((segment) => segment.trim())))
60
77
  throw new Error("HOST_STREAM_DISCONNECTED");
61
78
  }
62
79
  finally {
@@ -170,6 +170,12 @@ export async function startDaemonServer({ homePath, modules: registrations = [],
170
170
  }
171
171
  : request;
172
172
  };
173
+ const configuredStreamLimits = (request) => {
174
+ const selectedAdapter = contextItem(request.contexts, "octo.execution", "adapter")?.payload
175
+ .type;
176
+ const adapterType = typeof selectedAdapter === "string" ? selectedAdapter : "codex";
177
+ return localConfigurations(request.runMetadata)?.[adapterType]?.streamLimits;
178
+ };
173
179
  const transportHost = {
174
180
  list: async (configurations) => readyHost().client.list(configurations ?? localConfigurations()),
175
181
  probe: async (adapterType, options) => readyHost().client.probe(adapterType, options ?? localConfigurations()?.[adapterType]),
@@ -278,7 +284,7 @@ export async function startDaemonServer({ homePath, modules: registrations = [],
278
284
  process.child.once("exit", (code, signal) => handleAdapterHostExit(process, code, signal));
279
285
  }
280
286
  monitorAdapterHost(hostProcess);
281
- const host = new HostRunService(transportHost);
287
+ const host = new HostRunService(transportHost, configuredStreamLimits);
282
288
  const modules = new DaemonModules(registrations, {
283
289
  host,
284
290
  homePath: homePath ?? dirname(socketPath),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-daemon",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -26,22 +26,22 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@mininglamp-oss/octo-runtime-adapter-codex": "1.0.0",
30
- "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.0.0",
31
- "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.0.0",
32
- "@mininglamp-oss/octo-runtime-adapter-hermes": "1.0.0",
33
- "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.0.0",
34
- "@mininglamp-oss/octo-runtime-adapter-mcode": "1.0.0",
35
- "@mininglamp-oss/octo-runtime-adapter-opencode": "1.0.0",
36
- "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.0.0",
37
- "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.0.0",
38
- "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.0.0",
39
- "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.0.0",
40
- "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.0.0",
41
- "@mininglamp-oss/octo-runtime-core": "1.0.0",
42
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.0.0",
43
- "@mininglamp-oss/octo-runtime-adapter-host": "1.0.0",
44
- "@mininglamp-oss/octo-runtime-protocol": "1.0.0",
29
+ "@mininglamp-oss/octo-runtime-adapter-codex": "1.0.1",
30
+ "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.0.1",
31
+ "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.0.1",
32
+ "@mininglamp-oss/octo-runtime-adapter-hermes": "1.0.1",
33
+ "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.0.1",
34
+ "@mininglamp-oss/octo-runtime-adapter-mcode": "1.0.1",
35
+ "@mininglamp-oss/octo-runtime-adapter-opencode": "1.0.1",
36
+ "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.0.1",
37
+ "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.0.1",
38
+ "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.0.1",
39
+ "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.0.1",
40
+ "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.0.1",
41
+ "@mininglamp-oss/octo-runtime-core": "1.0.1",
42
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.0.1",
43
+ "@mininglamp-oss/octo-runtime-adapter-host": "1.0.1",
44
+ "@mininglamp-oss/octo-runtime-protocol": "1.0.1",
45
45
  "ajv": "8.20.0",
46
46
  "yaml": "2.9.1"
47
47
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-daemon-app",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,13 +21,13 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.0.0",
25
- "@mininglamp-oss/octo-runtime-extra-channel-gateway": "1.0.0",
26
- "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.0.0",
24
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.0.1",
25
+ "@mininglamp-oss/octo-runtime-extra-channel-gateway": "1.0.1",
26
+ "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.0.1",
27
27
  "json5": "2.2.3",
28
- "@mininglamp-oss/octo-runtime-adapter-host": "1.0.0",
29
- "@mininglamp-oss/octo-runtime-daemon": "1.0.0",
30
- "@mininglamp-oss/octo-runtime-protocol": "1.0.0"
28
+ "@mininglamp-oss/octo-runtime-adapter-host": "1.0.1",
29
+ "@mininglamp-oss/octo-runtime-daemon": "1.0.1",
30
+ "@mininglamp-oss/octo-runtime-protocol": "1.0.1"
31
31
  },
32
32
  "types": "./dist/server.d.ts"
33
33
  }