@arnilo/prism-coding-agent 0.0.25 → 0.0.26

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/limits.d.ts CHANGED
@@ -53,6 +53,9 @@ export declare const DEFAULT_MAX_GIT_MESSAGE_BYTES: number;
53
53
  export declare const HARD_MAX_GIT_MESSAGE_BYTES: number;
54
54
  export declare const DEFAULT_MAX_GIT_OUTPUT_BYTES: number;
55
55
  export declare const HARD_MAX_GIT_OUTPUT_BYTES: number;
56
+ /** Phase 9 freeze: `git ls-files` stdout cap for ignore-aware enumeration. */
57
+ export declare const DEFAULT_MAX_LS_FILES_OUTPUT_BYTES: number;
58
+ export declare const HARD_MAX_LS_FILES_OUTPUT_BYTES: number;
56
59
  export declare const DEFAULT_MAX_GIT_DIFF_LINES = 10000;
57
60
  export declare const HARD_MAX_GIT_DIFF_LINES = 100000;
58
61
  export declare const DEFAULT_MAX_GIT_CHANGED_FILES = 1000;
@@ -92,6 +95,44 @@ export declare const DEFAULT_MAX_CHECK_SUMMARY_BYTES = 1024;
92
95
  export declare const HARD_MAX_CHECK_SUMMARY_BYTES = 8192;
93
96
  export declare const DEFAULT_MAX_CODING_CHECKPOINT_BYTES: number;
94
97
  export declare const HARD_MAX_CODING_CHECKPOINT_BYTES: number;
98
+ /** Phase 9 freeze: language-intelligence / LSP client caps. */
99
+ export declare const DEFAULT_MAX_LSP_MESSAGE_BYTES: number;
100
+ export declare const HARD_MAX_LSP_MESSAGE_BYTES: number;
101
+ export declare const DEFAULT_MAX_LSP_DIAGNOSTICS_PER_FILE = 200;
102
+ export declare const HARD_MAX_LSP_DIAGNOSTICS_PER_FILE = 1000;
103
+ export declare const DEFAULT_MAX_LSP_PENDING_REQUESTS = 32;
104
+ export declare const HARD_MAX_LSP_PENDING_REQUESTS = 128;
105
+ export declare const DEFAULT_MAX_LSP_RESULTS_PER_QUERY = 500;
106
+ export declare const HARD_MAX_LSP_RESULTS_PER_QUERY = 5000;
107
+ export declare const DEFAULT_MAX_LSP_TIMEOUT_MS = 30000;
108
+ export declare const HARD_MAX_LSP_TIMEOUT_MS = 120000;
109
+ export declare const DEFAULT_MAX_LSP_SERVERS = 4;
110
+ export declare const HARD_MAX_LSP_SERVERS = 8;
111
+ /** Freeze: restart budget is fixed at 3 (not host-configurable above). */
112
+ export declare const LSP_RESTARTS_PER_SERVER = 3;
113
+ /** Phase 9 freeze: managed process-session caps. */
114
+ export declare const DEFAULT_MAX_PROCESS_SESSIONS = 8;
115
+ export declare const HARD_MAX_PROCESS_SESSIONS = 32;
116
+ export declare const DEFAULT_MAX_PROCESS_INPUT_BYTES: number;
117
+ export declare const HARD_MAX_PROCESS_INPUT_BYTES: number;
118
+ export declare const DEFAULT_MAX_PROCESS_LIFETIME_MS: number;
119
+ export declare const HARD_MAX_PROCESS_LIFETIME_MS: number;
120
+ export declare const DEFAULT_MAX_PROCESS_OUTPUT_CHUNK_BYTES: number;
121
+ export declare const HARD_MAX_PROCESS_OUTPUT_CHUNK_BYTES: number;
122
+ /** Total output reuses existing accumulator ceilings (64 MiB / 1 GiB). */
123
+ export declare const DEFAULT_MAX_PROCESS_TOTAL_OUTPUT_BYTES: number;
124
+ export declare const HARD_MAX_PROCESS_TOTAL_OUTPUT_BYTES: number;
125
+ /** Forge (GitHub adapter) defaults and hard caps (Phase 9 Task 5). */
126
+ export declare const DEFAULT_MAX_FORGE_PAGES_PER_OPERATION = 10;
127
+ export declare const HARD_MAX_FORGE_PAGES_PER_OPERATION = 100;
128
+ export declare const DEFAULT_MAX_FORGE_PAYLOAD_BYTES: number;
129
+ export declare const HARD_MAX_FORGE_PAYLOAD_BYTES: number;
130
+ export declare const DEFAULT_MAX_FORGE_COMMENTS_PER_REVIEW = 100;
131
+ export declare const HARD_MAX_FORGE_COMMENTS_PER_REVIEW = 1000;
132
+ export declare const DEFAULT_MAX_FORGE_REQUEST_CONCURRENCY = 4;
133
+ export declare const HARD_MAX_FORGE_REQUEST_CONCURRENCY = 8;
134
+ export declare const DEFAULT_MAX_FORGE_REQUEST_TIMEOUT_MS = 30000;
135
+ export declare const HARD_MAX_FORGE_REQUEST_TIMEOUT_MS = 120000;
95
136
  /** Validate one configurable coding resource limit. Invalid values fail instead of clamping. */
96
137
  export declare function validateCodingLimit(name: string, value: number, hardCap: number): number;
97
138
  /** Validate a non-negative integer limit (0 allowed), still capped. */
package/dist/limits.js CHANGED
@@ -53,6 +53,9 @@ export const DEFAULT_MAX_GIT_MESSAGE_BYTES = 64 * 1024;
53
53
  export const HARD_MAX_GIT_MESSAGE_BYTES = 256 * 1024;
54
54
  export const DEFAULT_MAX_GIT_OUTPUT_BYTES = 4 * 1024 * 1024;
55
55
  export const HARD_MAX_GIT_OUTPUT_BYTES = 64 * 1024 * 1024;
56
+ /** Phase 9 freeze: `git ls-files` stdout cap for ignore-aware enumeration. */
57
+ export const DEFAULT_MAX_LS_FILES_OUTPUT_BYTES = 8 * 1024 * 1024;
58
+ export const HARD_MAX_LS_FILES_OUTPUT_BYTES = 64 * 1024 * 1024;
56
59
  export const DEFAULT_MAX_GIT_DIFF_LINES = 10_000;
57
60
  export const HARD_MAX_GIT_DIFF_LINES = 100_000;
58
61
  export const DEFAULT_MAX_GIT_CHANGED_FILES = 1_000;
@@ -92,6 +95,44 @@ export const DEFAULT_MAX_CHECK_SUMMARY_BYTES = 1_024;
92
95
  export const HARD_MAX_CHECK_SUMMARY_BYTES = 8_192;
93
96
  export const DEFAULT_MAX_CODING_CHECKPOINT_BYTES = 64 * 1024;
94
97
  export const HARD_MAX_CODING_CHECKPOINT_BYTES = 512 * 1024;
98
+ /** Phase 9 freeze: language-intelligence / LSP client caps. */
99
+ export const DEFAULT_MAX_LSP_MESSAGE_BYTES = 4 * 1024 * 1024;
100
+ export const HARD_MAX_LSP_MESSAGE_BYTES = 32 * 1024 * 1024;
101
+ export const DEFAULT_MAX_LSP_DIAGNOSTICS_PER_FILE = 200;
102
+ export const HARD_MAX_LSP_DIAGNOSTICS_PER_FILE = 1_000;
103
+ export const DEFAULT_MAX_LSP_PENDING_REQUESTS = 32;
104
+ export const HARD_MAX_LSP_PENDING_REQUESTS = 128;
105
+ export const DEFAULT_MAX_LSP_RESULTS_PER_QUERY = 500;
106
+ export const HARD_MAX_LSP_RESULTS_PER_QUERY = 5_000;
107
+ export const DEFAULT_MAX_LSP_TIMEOUT_MS = 30_000;
108
+ export const HARD_MAX_LSP_TIMEOUT_MS = 120_000;
109
+ export const DEFAULT_MAX_LSP_SERVERS = 4;
110
+ export const HARD_MAX_LSP_SERVERS = 8;
111
+ /** Freeze: restart budget is fixed at 3 (not host-configurable above). */
112
+ export const LSP_RESTARTS_PER_SERVER = 3;
113
+ /** Phase 9 freeze: managed process-session caps. */
114
+ export const DEFAULT_MAX_PROCESS_SESSIONS = 8;
115
+ export const HARD_MAX_PROCESS_SESSIONS = 32;
116
+ export const DEFAULT_MAX_PROCESS_INPUT_BYTES = 64 * 1024;
117
+ export const HARD_MAX_PROCESS_INPUT_BYTES = 1024 * 1024;
118
+ export const DEFAULT_MAX_PROCESS_LIFETIME_MS = 4 * 60 * 60 * 1000;
119
+ export const HARD_MAX_PROCESS_LIFETIME_MS = 24 * 60 * 60 * 1000;
120
+ export const DEFAULT_MAX_PROCESS_OUTPUT_CHUNK_BYTES = 50 * 1024;
121
+ export const HARD_MAX_PROCESS_OUTPUT_CHUNK_BYTES = 1024 * 1024;
122
+ /** Total output reuses existing accumulator ceilings (64 MiB / 1 GiB). */
123
+ export const DEFAULT_MAX_PROCESS_TOTAL_OUTPUT_BYTES = DEFAULT_MAX_TOTAL_OUTPUT_BYTES;
124
+ export const HARD_MAX_PROCESS_TOTAL_OUTPUT_BYTES = HARD_MAX_TOTAL_OUTPUT_BYTES;
125
+ /** Forge (GitHub adapter) defaults and hard caps (Phase 9 Task 5). */
126
+ export const DEFAULT_MAX_FORGE_PAGES_PER_OPERATION = 10;
127
+ export const HARD_MAX_FORGE_PAGES_PER_OPERATION = 100;
128
+ export const DEFAULT_MAX_FORGE_PAYLOAD_BYTES = 1024 * 1024;
129
+ export const HARD_MAX_FORGE_PAYLOAD_BYTES = 8 * 1024 * 1024;
130
+ export const DEFAULT_MAX_FORGE_COMMENTS_PER_REVIEW = 100;
131
+ export const HARD_MAX_FORGE_COMMENTS_PER_REVIEW = 1000;
132
+ export const DEFAULT_MAX_FORGE_REQUEST_CONCURRENCY = 4;
133
+ export const HARD_MAX_FORGE_REQUEST_CONCURRENCY = 8;
134
+ export const DEFAULT_MAX_FORGE_REQUEST_TIMEOUT_MS = 30_000;
135
+ export const HARD_MAX_FORGE_REQUEST_TIMEOUT_MS = 120_000;
95
136
  /** Validate one configurable coding resource limit. Invalid values fail instead of clamping. */
96
137
  export function validateCodingLimit(name, value, hardCap) {
97
138
  if (!Number.isSafeInteger(value) || value < 1 || value > hardCap) {
@@ -46,6 +46,14 @@ export declare class OutputAccumulator {
46
46
  cleanupTempFile(): Promise<void>;
47
47
  getLastLineBytes(): number;
48
48
  getTotalRawBytes(): number;
49
+ /**
50
+ * Cursor-paged raw bytes for process sessions.
51
+ * Reads from spill file when present, otherwise from in-memory chunks.
52
+ */
53
+ readRaw(cursor: number, maxBytes: number): {
54
+ readonly data: Buffer;
55
+ readonly nextCursor: number;
56
+ };
49
57
  isOutputLimitExceeded(): boolean;
50
58
  hasStorageError(): boolean;
51
59
  private appendDecodedText;
@@ -1,6 +1,6 @@
1
1
  /** Streaming UTF-8 output retention with bounded memory and spill storage. */
2
2
  import { randomBytes } from "node:crypto";
3
- import { closeSync, openSync, writeSync } from "node:fs";
3
+ import { closeSync, openSync, readSync, writeSync } from "node:fs";
4
4
  import { rm } from "node:fs/promises";
5
5
  import { tmpdir } from "node:os";
6
6
  import { join } from "node:path";
@@ -144,6 +144,50 @@ export class OutputAccumulator {
144
144
  getTotalRawBytes() {
145
145
  return this.totalRawBytes;
146
146
  }
147
+ /**
148
+ * Cursor-paged raw bytes for process sessions.
149
+ * Reads from spill file when present, otherwise from in-memory chunks.
150
+ */
151
+ readRaw(cursor, maxBytes) {
152
+ if (!Number.isSafeInteger(cursor) || cursor < 0) {
153
+ throw new Error("cursor must be a non-negative safe integer");
154
+ }
155
+ if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) {
156
+ throw new Error("maxBytes must be a positive safe integer");
157
+ }
158
+ const total = this.totalRawBytes;
159
+ if (cursor >= total)
160
+ return { data: Buffer.alloc(0), nextCursor: cursor };
161
+ const length = Math.min(maxBytes, total - cursor);
162
+ if (this.tempFilePath) {
163
+ const fd = openSync(this.tempFilePath, "r");
164
+ try {
165
+ const data = Buffer.alloc(length);
166
+ const n = readSync(fd, data, 0, length, cursor);
167
+ return { data: n === length ? data : data.subarray(0, n), nextCursor: cursor + n };
168
+ }
169
+ finally {
170
+ closeSync(fd);
171
+ }
172
+ }
173
+ const data = Buffer.alloc(length);
174
+ let offset = 0;
175
+ let skipped = 0;
176
+ for (const chunk of this.rawChunks) {
177
+ if (offset >= length)
178
+ break;
179
+ if (skipped + chunk.length <= cursor) {
180
+ skipped += chunk.length;
181
+ continue;
182
+ }
183
+ const start = Math.max(0, cursor - skipped);
184
+ const take = Math.min(chunk.length - start, length - offset);
185
+ chunk.copy(data, offset, start, start + take);
186
+ offset += take;
187
+ skipped += chunk.length;
188
+ }
189
+ return { data: offset === length ? data : data.subarray(0, offset), nextCursor: cursor + offset };
190
+ }
147
191
  isOutputLimitExceeded() {
148
192
  return this.exceeded;
149
193
  }
@@ -0,0 +1,3 @@
1
+ export type { CodingProcessEvent, CreateProcessSessionsOptions, ProcessExitResult, ProcessOutputChunk, ProcessSandboxBackend, ProcessSandboxHandle, ProcessSandboxStartRequest, ProcessSession, ProcessSessionLimits, ProcessSessionMetadata, ProcessSessions, ProcessSessionState, ProcessStartRequest, ResolvedProcessSessionLimits, } from "./types.js";
2
+ export { ProcessSessionError, resolveProcessSessionLimits } from "./types.js";
3
+ export { createProcessSessions } from "./sessions.js";
@@ -0,0 +1,3 @@
1
+ export { ProcessSessionError, resolveProcessSessionLimits } from "./types.js";
2
+ export { createProcessSessions } from "./sessions.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import { type CreateProcessSessionsOptions, type ProcessSessions } from "./types.js";
2
+ export declare function createProcessSessions(options: CreateProcessSessionsOptions): ProcessSessions;