@gajae-code/coding-agent 0.11.6 → 0.11.7
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/CHANGELOG.md +37 -0
- package/dist/types/capability/index.d.ts +10 -20
- package/dist/types/capability/types.d.ts +3 -0
- package/dist/types/commands/daemon.d.ts +2 -2
- package/dist/types/commands/sdk.d.ts +20 -2
- package/dist/types/config/keybindings.d.ts +1 -1
- package/dist/types/config/settings-schema.d.ts +56 -6
- package/dist/types/eval/py/runner-artifact.d.ts +8 -0
- package/dist/types/gjc-runtime/ultragoal-guard.d.ts +5 -5
- package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +20 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +19 -5
- package/dist/types/main.d.ts +24 -1
- package/dist/types/modes/components/btw-panel.d.ts +1 -0
- package/dist/types/modes/components/model-selector.d.ts +2 -0
- package/dist/types/modes/components/tool-status-header.d.ts +1 -0
- package/dist/types/modes/controllers/btw-controller.d.ts +5 -0
- package/dist/types/modes/interactive-mode.d.ts +2 -0
- package/dist/types/modes/types.d.ts +1 -0
- package/dist/types/runtime-mcp/content-limits.d.ts +7 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +2 -1
- package/dist/types/sdk/bus/index.d.ts +1 -1
- package/dist/types/sdk/bus/lifecycle-commands.d.ts +5 -4
- package/dist/types/sdk/bus/notification-service.d.ts +34 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +8 -3
- package/dist/types/sdk/bus/telegram-daemon.d.ts +61 -3
- package/dist/types/sdk/bus/topic-registry.d.ts +88 -2
- package/dist/types/sdk/client/discovery.d.ts +2 -0
- package/dist/types/sdk/client/liveness.d.ts +7 -0
- package/dist/types/sdk/transport/auth-preface.d.ts +9 -0
- package/dist/types/sdk/transport/index.d.ts +12 -0
- package/dist/types/sdk/transport/relay.d.ts +43 -0
- package/dist/types/sdk/transport/serve-cli.d.ts +4 -0
- package/dist/types/sdk/transport/socket.d.ts +7 -0
- package/dist/types/sdk/transport/stdio.d.ts +3 -0
- package/dist/types/session/agent-session.d.ts +28 -5
- package/dist/types/session/btw-contract.d.ts +16 -0
- package/dist/types/session/internal/managed-session-scope.d.ts +21 -7
- package/dist/types/session/internal/managed-session-storage.d.ts +10 -8
- package/dist/types/session/session-manager.d.ts +25 -4
- package/dist/types/setup/credential-import.d.ts +5 -1
- package/dist/types/setup/provider-onboarding.d.ts +2 -0
- package/dist/types/ssh/utils.d.ts +1 -0
- package/dist/types/task/discovery.d.ts +3 -1
- package/dist/types/tools/fetch.d.ts +5 -8
- package/dist/types/tools/image-gen.d.ts +16 -0
- package/dist/types/tools/skill-discovery.d.ts +7 -0
- package/dist/types/tools/sqlite-reader.d.ts +7 -0
- package/dist/types/utils/shell-snapshot.d.ts +12 -0
- package/dist/types/web/insane/bridge.d.ts +1 -0
- package/dist/types/web/insane/url-guard.d.ts +17 -0
- package/package.json +8 -8
- package/scripts/generate-sdk-operation-inventory.ts +2 -0
- package/src/capability/index.ts +50 -42
- package/src/capability/types.ts +3 -0
- package/src/cli/setup-cli.ts +10 -4
- package/src/cli.ts +34 -9
- package/src/commands/daemon.ts +22 -5
- package/src/commands/sdk.ts +42 -9
- package/src/config/keybindings.ts +1 -1
- package/src/config/model-profiles.ts +18 -0
- package/src/config/settings-schema.ts +57 -6
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +42 -1
- package/src/discovery/ssh.ts +12 -1
- package/src/eval/py/kernel.ts +1 -21
- package/src/eval/py/runner-artifact.ts +84 -0
- package/src/extensibility/plugins/marketplace/fetcher.ts +191 -7
- package/src/gjc-runtime/ultragoal-guard.ts +88 -10
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +103 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +275 -12
- package/src/gjc-runtime/workflow-manifest.generated.json +58 -0
- package/src/gjc-runtime/workflow-manifest.ts +23 -0
- package/src/internal-urls/docs-index.generated.ts +8 -7
- package/src/internal-urls/local-protocol.ts +32 -6
- package/src/main.ts +86 -27
- package/src/modes/action-registry.ts +1 -1
- package/src/modes/components/btw-panel.ts +82 -16
- package/src/modes/components/model-selector.ts +31 -3
- package/src/modes/components/tool-status-header.ts +6 -1
- package/src/modes/controllers/btw-controller.ts +119 -36
- package/src/modes/controllers/input-controller.ts +31 -0
- package/src/modes/controllers/selector-controller.ts +106 -12
- package/src/modes/interactive-mode.ts +16 -7
- package/src/modes/types.ts +1 -0
- package/src/prompts/system/btw-user.md +3 -8
- package/src/prompts/tools/skill-discovery.md +1 -0
- package/src/runtime-mcp/client.ts +41 -55
- package/src/runtime-mcp/content-limits.ts +71 -0
- package/src/runtime-mcp/json-rpc.ts +23 -9
- package/src/runtime-mcp/transports/http.ts +50 -16
- package/src/sdk/bus/chat-daemon-control.ts +4 -3
- package/src/sdk/bus/index.ts +4 -5
- package/src/sdk/bus/lifecycle-commands.ts +16 -7
- package/src/sdk/bus/notification-service.ts +41 -18
- package/src/sdk/bus/telegram-daemon-contract.ts +8 -3
- package/src/sdk/bus/telegram-daemon-control.ts +2 -2
- package/src/sdk/bus/telegram-daemon.ts +1663 -375
- package/src/sdk/bus/topic-registry.ts +451 -12
- package/src/sdk/client/discovery.ts +19 -3
- package/src/sdk/client/liveness.ts +49 -0
- package/src/sdk/protocol/operation-inventory.generated.json +11 -0
- package/src/sdk/session.ts +29 -5
- package/src/sdk/transport/auth-preface.ts +82 -0
- package/src/sdk/transport/index.ts +18 -0
- package/src/sdk/transport/relay.ts +252 -0
- package/src/sdk/transport/serve-cli.ts +105 -0
- package/src/sdk/transport/socket.ts +197 -0
- package/src/sdk/transport/stdio.ts +17 -0
- package/src/session/agent-session.ts +240 -149
- package/src/session/blob-store.ts +19 -6
- package/src/session/btw-contract.ts +59 -0
- package/src/session/internal/managed-session-scope.ts +313 -57
- package/src/session/internal/managed-session-storage.ts +146 -35
- package/src/session/session-manager.ts +319 -85
- package/src/setup/credential-import.ts +28 -3
- package/src/setup/provider-onboarding.ts +30 -1
- package/src/setup/provider-presets.json +2 -1
- package/src/slash-commands/builtin-registry.ts +1 -1
- package/src/ssh/utils.ts +14 -0
- package/src/task/discovery.ts +8 -2
- package/src/tools/ask.ts +1 -1
- package/src/tools/fetch.ts +13 -131
- package/src/tools/image-gen.ts +301 -20
- package/src/tools/read.ts +2 -0
- package/src/tools/skill-discovery.ts +39 -3
- package/src/tools/sqlite-reader.ts +63 -5
- package/src/utils/pasted-image-path.ts +15 -6
- package/src/utils/shell-snapshot.ts +173 -63
- package/src/web/insane/bridge.ts +5 -1
- package/src/web/insane/url-guard.ts +138 -27
- package/src/web/scrapers/types.ts +19 -49
- package/src/web/scrapers/utils.ts +12 -26
|
@@ -5,6 +5,18 @@ import { isEnoent, logger } from "@gajae-code/utils";
|
|
|
5
5
|
|
|
6
6
|
const BLOB_PREFIX = "blob:sha256:";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Owner-only permissions for on-disk blob directories and files.
|
|
10
|
+
*
|
|
11
|
+
* Blob stores can live inside a managed session scope (e.g. the resident-cache
|
|
12
|
+
* `EphemeralBlobStore` created on the explicit session path). The managed-tree
|
|
13
|
+
* snapshot fails closed unless every descendant is owner-only, so blobs and
|
|
14
|
+
* their directories MUST be created 0700/0600 rather than inheriting a
|
|
15
|
+
* group/other-readable mode from the process umask.
|
|
16
|
+
*/
|
|
17
|
+
const BLOB_DIR_MODE = 0o700;
|
|
18
|
+
const BLOB_FILE_MODE = 0o600;
|
|
19
|
+
|
|
8
20
|
export interface BlobPutResult {
|
|
9
21
|
hash: string;
|
|
10
22
|
path: string;
|
|
@@ -113,6 +125,7 @@ export class BlobStore {
|
|
|
113
125
|
};
|
|
114
126
|
|
|
115
127
|
await Bun.write(blobPath, data);
|
|
128
|
+
await fsp.chmod(blobPath, BLOB_FILE_MODE);
|
|
116
129
|
return result;
|
|
117
130
|
}
|
|
118
131
|
|
|
@@ -131,8 +144,8 @@ export class BlobStore {
|
|
|
131
144
|
return `${BLOB_PREFIX}${hash}`;
|
|
132
145
|
},
|
|
133
146
|
};
|
|
134
|
-
fs.mkdirSync(this.dir, { recursive: true });
|
|
135
|
-
fs.writeFileSync(blobPath, data);
|
|
147
|
+
fs.mkdirSync(this.dir, { recursive: true, mode: BLOB_DIR_MODE });
|
|
148
|
+
fs.writeFileSync(blobPath, data, { mode: BLOB_FILE_MODE });
|
|
136
149
|
return result;
|
|
137
150
|
}
|
|
138
151
|
|
|
@@ -147,7 +160,7 @@ export class BlobStore {
|
|
|
147
160
|
const hash = sha256Hex(data);
|
|
148
161
|
const blobPath = path.join(this.dir, hash);
|
|
149
162
|
const result = makeBlobPutResult(hash, blobPath, data.byteLength);
|
|
150
|
-
fs.mkdirSync(this.dir, { recursive: true });
|
|
163
|
+
fs.mkdirSync(this.dir, { recursive: true, mode: BLOB_DIR_MODE });
|
|
151
164
|
|
|
152
165
|
if (fs.existsSync(blobPath)) {
|
|
153
166
|
verifyBlobFileSync(hash, blobPath);
|
|
@@ -156,7 +169,7 @@ export class BlobStore {
|
|
|
156
169
|
|
|
157
170
|
const tempPath = uniqueTempBlobPath(this.dir, hash);
|
|
158
171
|
try {
|
|
159
|
-
const fd = fs.openSync(tempPath, "wx");
|
|
172
|
+
const fd = fs.openSync(tempPath, "wx", BLOB_FILE_MODE);
|
|
160
173
|
try {
|
|
161
174
|
fs.writeFileSync(fd, data);
|
|
162
175
|
fs.fsyncSync(fd);
|
|
@@ -274,7 +287,7 @@ export class EphemeralBlobStore extends BlobStore {
|
|
|
274
287
|
constructor(dir: string) {
|
|
275
288
|
super(dir);
|
|
276
289
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
277
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
290
|
+
fs.mkdirSync(dir, { recursive: true, mode: BLOB_DIR_MODE });
|
|
278
291
|
}
|
|
279
292
|
|
|
280
293
|
#cachePut(hash: string, data: Buffer): void {
|
|
@@ -333,7 +346,7 @@ export class EphemeralBlobStore extends BlobStore {
|
|
|
333
346
|
this.#bufferCache.clear();
|
|
334
347
|
this.#bufferCacheBytes = 0;
|
|
335
348
|
fs.rmSync(this.dir, { recursive: true, force: true });
|
|
336
|
-
fs.mkdirSync(this.dir, { recursive: true });
|
|
349
|
+
fs.mkdirSync(this.dir, { recursive: true, mode: BLOB_DIR_MODE });
|
|
337
350
|
}
|
|
338
351
|
|
|
339
352
|
dispose(): void {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const BTW_MAX_CONTEXT_TURNS = 12;
|
|
2
|
+
export const BTW_MAX_CONTEXT_UTF8_BYTES = 64 * 1024;
|
|
3
|
+
export const BTW_MAX_QUESTION_UTF8_BYTES = 16 * 1024;
|
|
4
|
+
export const BTW_MAX_ANSWER_UTF8_BYTES = 32 * 1024;
|
|
5
|
+
export const BTW_MAX_ERROR_UTF8_BYTES = 4 * 1024;
|
|
6
|
+
export const BTW_STREAM_IDLE_TIMEOUT_MS = 30_000;
|
|
7
|
+
export const BTW_STREAM_TOTAL_TIMEOUT_MS = 120_000;
|
|
8
|
+
|
|
9
|
+
export interface BtwTextExchange {
|
|
10
|
+
question: string;
|
|
11
|
+
answer: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function utf8ByteLength(text: string): number {
|
|
15
|
+
return Buffer.byteLength(text, "utf8");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function truncateUtf8(text: string, maxBytes: number): string {
|
|
19
|
+
if (utf8ByteLength(text) <= maxBytes) return text;
|
|
20
|
+
let bytes = 0;
|
|
21
|
+
let result = "";
|
|
22
|
+
for (const character of text) {
|
|
23
|
+
const characterBytes = utf8ByteLength(character);
|
|
24
|
+
if (bytes + characterBytes > maxBytes) break;
|
|
25
|
+
result += character;
|
|
26
|
+
bytes += characterBytes;
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function sanitizeBtwError(text: string): string {
|
|
32
|
+
const sanitized = text
|
|
33
|
+
.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, " ")
|
|
34
|
+
.replace(/[\u202A-\u202E\u2066-\u2069]/g, "")
|
|
35
|
+
.replace(/\s+/g, " ")
|
|
36
|
+
.trim();
|
|
37
|
+
return truncateUtf8(sanitized || "Side-chat request failed.", BTW_MAX_ERROR_UTF8_BYTES);
|
|
38
|
+
}
|
|
39
|
+
export function exchangeUtf8Bytes(exchange: BtwTextExchange): number {
|
|
40
|
+
return utf8ByteLength(exchange.question) + utf8ByteLength(exchange.answer);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function boundBtwExchanges(exchanges: readonly BtwTextExchange[]): BtwTextExchange[] {
|
|
44
|
+
const bounded: BtwTextExchange[] = [];
|
|
45
|
+
let totalBytes = 0;
|
|
46
|
+
for (let index = exchanges.length - 1; index >= 0 && bounded.length < BTW_MAX_CONTEXT_TURNS; index -= 1) {
|
|
47
|
+
const exchange = exchanges[index];
|
|
48
|
+
if (!exchange) continue;
|
|
49
|
+
const normalized = {
|
|
50
|
+
question: truncateUtf8(exchange.question, BTW_MAX_QUESTION_UTF8_BYTES),
|
|
51
|
+
answer: truncateUtf8(exchange.answer, BTW_MAX_ANSWER_UTF8_BYTES),
|
|
52
|
+
};
|
|
53
|
+
const bytes = exchangeUtf8Bytes(normalized);
|
|
54
|
+
if (bytes > BTW_MAX_CONTEXT_UTF8_BYTES - totalBytes) break;
|
|
55
|
+
bounded.unshift(normalized);
|
|
56
|
+
totalBytes += bytes;
|
|
57
|
+
}
|
|
58
|
+
return bounded;
|
|
59
|
+
}
|