@intutic/shared-types 1.10.0 → 2.0.0
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/README.md +1 -1
- package/dist/anomaly.d.ts +11 -0
- package/dist/anomaly.d.ts.map +1 -1
- package/dist/api-contracts.d.ts +97 -9
- package/dist/api-contracts.d.ts.map +1 -1
- package/dist/api-contracts.js +9 -0
- package/dist/api-contracts.js.map +1 -1
- package/dist/auth.d.ts +164 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +39 -1
- package/dist/auth.js.map +1 -1
- package/dist/billing.d.ts +2 -99
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +2 -17
- package/dist/billing.js.map +1 -1
- package/dist/enums.d.ts +341 -4
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +369 -6
- package/dist/enums.js.map +1 -1
- package/dist/errors.d.ts +20 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +20 -1
- package/dist/errors.js.map +1 -1
- package/dist/finops.d.ts +97 -1
- package/dist/finops.d.ts.map +1 -1
- package/dist/governanceCoverage.d.ts +82 -0
- package/dist/governanceCoverage.d.ts.map +1 -0
- package/dist/governanceCoverage.js +72 -0
- package/dist/governanceCoverage.js.map +1 -0
- package/dist/guardrailIr.d.ts +287 -0
- package/dist/guardrailIr.d.ts.map +1 -0
- package/dist/guardrailIr.js +301 -0
- package/dist/guardrailIr.js.map +1 -0
- package/dist/guardrailRender.d.ts +154 -0
- package/dist/guardrailRender.d.ts.map +1 -0
- package/dist/guardrailRender.js +440 -0
- package/dist/guardrailRender.js.map +1 -0
- package/dist/identity.d.ts +75 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +5 -1
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +34 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +124 -2
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +37 -11
- package/dist/intelligence.d.ts.map +1 -1
- package/dist/intelligence.js.map +1 -1
- package/dist/modelCatalog.d.ts +89 -0
- package/dist/modelCatalog.d.ts.map +1 -0
- package/dist/modelCatalog.generated.d.ts +7217 -0
- package/dist/modelCatalog.generated.d.ts.map +1 -0
- package/dist/modelCatalog.generated.js +577 -0
- package/dist/modelCatalog.generated.js.map +1 -0
- package/dist/modelCatalog.js +112 -0
- package/dist/modelCatalog.js.map +1 -0
- package/dist/notifications.d.ts +134 -2
- package/dist/notifications.d.ts.map +1 -1
- package/dist/observability.d.ts +4 -0
- package/dist/observability.d.ts.map +1 -1
- package/dist/policyGuardrails.d.ts +433 -0
- package/dist/policyGuardrails.d.ts.map +1 -0
- package/dist/policyGuardrails.js +91 -0
- package/dist/policyGuardrails.js.map +1 -0
- package/dist/posturePresets.d.ts +74 -0
- package/dist/posturePresets.d.ts.map +1 -0
- package/dist/posturePresets.js +139 -0
- package/dist/posturePresets.js.map +1 -0
- package/dist/providerVerification.d.ts +64 -0
- package/dist/providerVerification.d.ts.map +1 -0
- package/dist/providerVerification.js +184 -0
- package/dist/providerVerification.js.map +1 -0
- package/dist/providers.d.ts +93 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +176 -0
- package/dist/providers.js.map +1 -0
- package/dist/rulePredicateDsl.d.ts +101 -0
- package/dist/rulePredicateDsl.d.ts.map +1 -0
- package/dist/rulePredicateDsl.js +263 -0
- package/dist/rulePredicateDsl.js.map +1 -0
- package/dist/rulePredicateEval.d.ts +38 -0
- package/dist/rulePredicateEval.d.ts.map +1 -0
- package/dist/rulePredicateEval.js +124 -0
- package/dist/rulePredicateEval.js.map +1 -0
- package/dist/scriptScan.d.ts +162 -0
- package/dist/scriptScan.d.ts.map +1 -0
- package/dist/scriptScan.js +362 -0
- package/dist/scriptScan.js.map +1 -0
- package/dist/secretPatterns.d.ts +43 -0
- package/dist/secretPatterns.d.ts.map +1 -0
- package/dist/secretPatterns.js +73 -0
- package/dist/secretPatterns.js.map +1 -0
- package/dist/skillScan.d.ts +166 -0
- package/dist/skillScan.d.ts.map +1 -0
- package/dist/skillScan.js +398 -0
- package/dist/skillScan.js.map +1 -0
- package/dist/sop.d.ts +188 -9
- package/dist/sop.d.ts.map +1 -1
- package/dist/sop.js +54 -2
- package/dist/sop.js.map +1 -1
- package/dist/sourceProviders.d.ts +41 -0
- package/dist/sourceProviders.d.ts.map +1 -0
- package/dist/sourceProviders.js +48 -0
- package/dist/sourceProviders.js.map +1 -0
- package/dist/sync.d.ts +98 -8
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js.map +1 -1
- package/dist/toon.d.ts +80 -0
- package/dist/toon.d.ts.map +1 -0
- package/dist/toon.js +278 -0
- package/dist/toon.js.map +1 -0
- package/dist/usage.d.ts +23 -0
- package/dist/usage.d.ts.map +1 -1
- package/dist/wasmHost.d.ts +58 -0
- package/dist/wasmHost.d.ts.map +1 -0
- package/dist/wasmHost.js +80 -0
- package/dist/wasmHost.js.map +1 -0
- package/dist/workspaceSettings.d.ts +463 -21
- package/dist/workspaceSettings.d.ts.map +1 -1
- package/dist/workspaceSettings.js +86 -1
- package/dist/workspaceSettings.js.map +1 -1
- package/package.json +4 -3
package/dist/sync.d.ts
CHANGED
|
@@ -126,6 +126,24 @@ export interface IntuticConfig {
|
|
|
126
126
|
maxDailyBudgetUsd?: number;
|
|
127
127
|
/** Local daily spending cap limit in USD (alias). */
|
|
128
128
|
max_daily_budget_usd?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Local approved-models allowlist for a standalone proxy with no control
|
|
131
|
+
* plane (Wave 6.3, audit-remediation) — read directly from this file by
|
|
132
|
+
* `packages/proxy/src/local_config.rs`, not by any TS code today. Declared
|
|
133
|
+
* here so a hand-edited value survives `intutic init`'s config rewrite
|
|
134
|
+
* (which loads and spreads the existing config rather than overwriting it
|
|
135
|
+
* wholesale) and so its shape is documented in one place. Absent, or an
|
|
136
|
+
* empty array, both mean unrestricted — never "no model allowed."
|
|
137
|
+
*/
|
|
138
|
+
allowedModels?: string[];
|
|
139
|
+
/** Local approved-models allowlist (alias). */
|
|
140
|
+
allowed_models?: string[];
|
|
141
|
+
/**
|
|
142
|
+
* Workspace settings mirrored from the last successful sync, so policies
|
|
143
|
+
* that apply at proxy spawn (e.g. `allowLocalMemoryVaults`) survive a
|
|
144
|
+
* restart without waiting for the first fetch.
|
|
145
|
+
*/
|
|
146
|
+
settings?: WorkspaceSettings;
|
|
129
147
|
}
|
|
130
148
|
/** Local integrity store at .intutic/integrity.json (per-workspace). */
|
|
131
149
|
export interface IntegrityStore {
|
|
@@ -189,6 +207,30 @@ export declare const SopHashReportSchema: z.ZodObject<{
|
|
|
189
207
|
readonly GOOSE: "goose";
|
|
190
208
|
readonly OPEN_WEBUI: "open-webui";
|
|
191
209
|
readonly GITHUB_COPILOT: "github-copilot";
|
|
210
|
+
readonly LANGGRAPH: "langgraph";
|
|
211
|
+
readonly MUSE_CODE: "muse-code";
|
|
212
|
+
readonly GROK: "grok";
|
|
213
|
+
readonly OPENCODE: "opencode";
|
|
214
|
+
readonly DEEPSEEK_HARNESS: "dsh";
|
|
215
|
+
readonly XIRP: "xirp";
|
|
216
|
+
readonly AGENTIC_ORCHESTRATOR: "agentic-orchestrator";
|
|
217
|
+
readonly LANGCHAIN: "langchain";
|
|
218
|
+
readonly CREWAI: "crewai";
|
|
219
|
+
readonly AUTOGEN: "autogen";
|
|
220
|
+
readonly AG2: "ag2";
|
|
221
|
+
readonly GOOGLE_ADK: "google-adk";
|
|
222
|
+
readonly OPENAI_AGENTS: "openai-agents";
|
|
223
|
+
readonly PYDANTIC_AI: "pydantic-ai";
|
|
224
|
+
readonly SMOLAGENTS: "smolagents";
|
|
225
|
+
readonly STRANDS: "strands";
|
|
226
|
+
readonly MASTRA: "mastra";
|
|
227
|
+
readonly VERCEL_AI_SDK: "vercel-ai-sdk";
|
|
228
|
+
readonly EVE: "eve";
|
|
229
|
+
readonly TRUEFORGE: "trueforge";
|
|
230
|
+
readonly AI_SDK_HARNESS: "ai-sdk-harness";
|
|
231
|
+
readonly AI_SDK_WORKFLOW: "ai-sdk-workflow";
|
|
232
|
+
readonly AGENTCORE_RUNTIME: "agentcore-runtime";
|
|
233
|
+
readonly TRUEFORGE_SERVER: "trueforge-server";
|
|
192
234
|
}>;
|
|
193
235
|
files: z.ZodArray<z.ZodObject<{
|
|
194
236
|
filePath: z.ZodString;
|
|
@@ -209,7 +251,7 @@ export declare const SopHashReportSchema: z.ZodObject<{
|
|
|
209
251
|
reportedAt: z.ZodString;
|
|
210
252
|
}, "strip", z.ZodTypeAny, {
|
|
211
253
|
workspaceId: string;
|
|
212
|
-
harnessType: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot";
|
|
254
|
+
harnessType: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot" | "langgraph" | "muse-code" | "grok" | "opencode" | "dsh" | "xirp" | "agentic-orchestrator" | "langchain" | "crewai" | "autogen" | "ag2" | "google-adk" | "openai-agents" | "pydantic-ai" | "smolagents" | "strands" | "mastra" | "vercel-ai-sdk" | "eve" | "trueforge" | "ai-sdk-harness" | "ai-sdk-workflow" | "agentcore-runtime" | "trueforge-server";
|
|
213
255
|
files: {
|
|
214
256
|
filePath: string;
|
|
215
257
|
localHash: string;
|
|
@@ -219,7 +261,7 @@ export declare const SopHashReportSchema: z.ZodObject<{
|
|
|
219
261
|
reportedAt: string;
|
|
220
262
|
}, {
|
|
221
263
|
workspaceId: string;
|
|
222
|
-
harnessType: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot";
|
|
264
|
+
harnessType: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot" | "langgraph" | "muse-code" | "grok" | "opencode" | "dsh" | "xirp" | "agentic-orchestrator" | "langchain" | "crewai" | "autogen" | "ag2" | "google-adk" | "openai-agents" | "pydantic-ai" | "smolagents" | "strands" | "mastra" | "vercel-ai-sdk" | "eve" | "trueforge" | "ai-sdk-harness" | "ai-sdk-workflow" | "agentcore-runtime" | "trueforge-server";
|
|
223
265
|
files: {
|
|
224
266
|
filePath: string;
|
|
225
267
|
localHash: string;
|
|
@@ -254,17 +296,41 @@ export declare const DaemonStatusSchema: z.ZodObject<{
|
|
|
254
296
|
readonly GOOSE: "goose";
|
|
255
297
|
readonly OPEN_WEBUI: "open-webui";
|
|
256
298
|
readonly GITHUB_COPILOT: "github-copilot";
|
|
299
|
+
readonly LANGGRAPH: "langgraph";
|
|
300
|
+
readonly MUSE_CODE: "muse-code";
|
|
301
|
+
readonly GROK: "grok";
|
|
302
|
+
readonly OPENCODE: "opencode";
|
|
303
|
+
readonly DEEPSEEK_HARNESS: "dsh";
|
|
304
|
+
readonly XIRP: "xirp";
|
|
305
|
+
readonly AGENTIC_ORCHESTRATOR: "agentic-orchestrator";
|
|
306
|
+
readonly LANGCHAIN: "langchain";
|
|
307
|
+
readonly CREWAI: "crewai";
|
|
308
|
+
readonly AUTOGEN: "autogen";
|
|
309
|
+
readonly AG2: "ag2";
|
|
310
|
+
readonly GOOGLE_ADK: "google-adk";
|
|
311
|
+
readonly OPENAI_AGENTS: "openai-agents";
|
|
312
|
+
readonly PYDANTIC_AI: "pydantic-ai";
|
|
313
|
+
readonly SMOLAGENTS: "smolagents";
|
|
314
|
+
readonly STRANDS: "strands";
|
|
315
|
+
readonly MASTRA: "mastra";
|
|
316
|
+
readonly VERCEL_AI_SDK: "vercel-ai-sdk";
|
|
317
|
+
readonly EVE: "eve";
|
|
318
|
+
readonly TRUEFORGE: "trueforge";
|
|
319
|
+
readonly AI_SDK_HARNESS: "ai-sdk-harness";
|
|
320
|
+
readonly AI_SDK_WORKFLOW: "ai-sdk-workflow";
|
|
321
|
+
readonly AGENTCORE_RUNTIME: "agentcore-runtime";
|
|
322
|
+
readonly TRUEFORGE_SERVER: "trueforge-server";
|
|
257
323
|
}>;
|
|
258
324
|
configPath: z.ZodString;
|
|
259
325
|
detected: z.ZodBoolean;
|
|
260
326
|
lastWriteAt: z.ZodNullable<z.ZodString>;
|
|
261
327
|
}, "strip", z.ZodTypeAny, {
|
|
262
|
-
type: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot";
|
|
328
|
+
type: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot" | "langgraph" | "muse-code" | "grok" | "opencode" | "dsh" | "xirp" | "agentic-orchestrator" | "langchain" | "crewai" | "autogen" | "ag2" | "google-adk" | "openai-agents" | "pydantic-ai" | "smolagents" | "strands" | "mastra" | "vercel-ai-sdk" | "eve" | "trueforge" | "ai-sdk-harness" | "ai-sdk-workflow" | "agentcore-runtime" | "trueforge-server";
|
|
263
329
|
configPath: string;
|
|
264
330
|
detected: boolean;
|
|
265
331
|
lastWriteAt: string | null;
|
|
266
332
|
}, {
|
|
267
|
-
type: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot";
|
|
333
|
+
type: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot" | "langgraph" | "muse-code" | "grok" | "opencode" | "dsh" | "xirp" | "agentic-orchestrator" | "langchain" | "crewai" | "autogen" | "ag2" | "google-adk" | "openai-agents" | "pydantic-ai" | "smolagents" | "strands" | "mastra" | "vercel-ai-sdk" | "eve" | "trueforge" | "ai-sdk-harness" | "ai-sdk-workflow" | "agentcore-runtime" | "trueforge-server";
|
|
268
334
|
configPath: string;
|
|
269
335
|
detected: boolean;
|
|
270
336
|
lastWriteAt: string | null;
|
|
@@ -289,7 +355,7 @@ export declare const DaemonStatusSchema: z.ZodObject<{
|
|
|
289
355
|
connectedSince: string;
|
|
290
356
|
lastSyncAt: string;
|
|
291
357
|
harnesses: {
|
|
292
|
-
type: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot";
|
|
358
|
+
type: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot" | "langgraph" | "muse-code" | "grok" | "opencode" | "dsh" | "xirp" | "agentic-orchestrator" | "langchain" | "crewai" | "autogen" | "ag2" | "google-adk" | "openai-agents" | "pydantic-ai" | "smolagents" | "strands" | "mastra" | "vercel-ai-sdk" | "eve" | "trueforge" | "ai-sdk-harness" | "ai-sdk-workflow" | "agentcore-runtime" | "trueforge-server";
|
|
293
359
|
configPath: string;
|
|
294
360
|
detected: boolean;
|
|
295
361
|
lastWriteAt: string | null;
|
|
@@ -306,7 +372,7 @@ export declare const DaemonStatusSchema: z.ZodObject<{
|
|
|
306
372
|
connectedSince: string;
|
|
307
373
|
lastSyncAt: string;
|
|
308
374
|
harnesses: {
|
|
309
|
-
type: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot";
|
|
375
|
+
type: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot" | "langgraph" | "muse-code" | "grok" | "opencode" | "dsh" | "xirp" | "agentic-orchestrator" | "langchain" | "crewai" | "autogen" | "ag2" | "google-adk" | "openai-agents" | "pydantic-ai" | "smolagents" | "strands" | "mastra" | "vercel-ai-sdk" | "eve" | "trueforge" | "ai-sdk-harness" | "ai-sdk-workflow" | "agentcore-runtime" | "trueforge-server";
|
|
310
376
|
configPath: string;
|
|
311
377
|
detected: boolean;
|
|
312
378
|
lastWriteAt: string | null;
|
|
@@ -340,6 +406,30 @@ export declare const BatchConfigCapturePayloadSchema: z.ZodObject<{
|
|
|
340
406
|
readonly GOOSE: "goose";
|
|
341
407
|
readonly OPEN_WEBUI: "open-webui";
|
|
342
408
|
readonly GITHUB_COPILOT: "github-copilot";
|
|
409
|
+
readonly LANGGRAPH: "langgraph";
|
|
410
|
+
readonly MUSE_CODE: "muse-code";
|
|
411
|
+
readonly GROK: "grok";
|
|
412
|
+
readonly OPENCODE: "opencode";
|
|
413
|
+
readonly DEEPSEEK_HARNESS: "dsh";
|
|
414
|
+
readonly XIRP: "xirp";
|
|
415
|
+
readonly AGENTIC_ORCHESTRATOR: "agentic-orchestrator";
|
|
416
|
+
readonly LANGCHAIN: "langchain";
|
|
417
|
+
readonly CREWAI: "crewai";
|
|
418
|
+
readonly AUTOGEN: "autogen";
|
|
419
|
+
readonly AG2: "ag2";
|
|
420
|
+
readonly GOOGLE_ADK: "google-adk";
|
|
421
|
+
readonly OPENAI_AGENTS: "openai-agents";
|
|
422
|
+
readonly PYDANTIC_AI: "pydantic-ai";
|
|
423
|
+
readonly SMOLAGENTS: "smolagents";
|
|
424
|
+
readonly STRANDS: "strands";
|
|
425
|
+
readonly MASTRA: "mastra";
|
|
426
|
+
readonly VERCEL_AI_SDK: "vercel-ai-sdk";
|
|
427
|
+
readonly EVE: "eve";
|
|
428
|
+
readonly TRUEFORGE: "trueforge";
|
|
429
|
+
readonly AI_SDK_HARNESS: "ai-sdk-harness";
|
|
430
|
+
readonly AI_SDK_WORKFLOW: "ai-sdk-workflow";
|
|
431
|
+
readonly AGENTCORE_RUNTIME: "agentcore-runtime";
|
|
432
|
+
readonly TRUEFORGE_SERVER: "trueforge-server";
|
|
343
433
|
}>;
|
|
344
434
|
files: z.ZodArray<z.ZodObject<{
|
|
345
435
|
path: z.ZodString;
|
|
@@ -356,7 +446,7 @@ export declare const BatchConfigCapturePayloadSchema: z.ZodObject<{
|
|
|
356
446
|
}>, "many">;
|
|
357
447
|
}, "strip", z.ZodTypeAny, {
|
|
358
448
|
workspaceId: string;
|
|
359
|
-
harnessType: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot";
|
|
449
|
+
harnessType: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot" | "langgraph" | "muse-code" | "grok" | "opencode" | "dsh" | "xirp" | "agentic-orchestrator" | "langchain" | "crewai" | "autogen" | "ag2" | "google-adk" | "openai-agents" | "pydantic-ai" | "smolagents" | "strands" | "mastra" | "vercel-ai-sdk" | "eve" | "trueforge" | "ai-sdk-harness" | "ai-sdk-workflow" | "agentcore-runtime" | "trueforge-server";
|
|
360
450
|
files: {
|
|
361
451
|
path: string;
|
|
362
452
|
content: string;
|
|
@@ -364,7 +454,7 @@ export declare const BatchConfigCapturePayloadSchema: z.ZodObject<{
|
|
|
364
454
|
}[];
|
|
365
455
|
}, {
|
|
366
456
|
workspaceId: string;
|
|
367
|
-
harnessType: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot";
|
|
457
|
+
harnessType: "cursor" | "claude-code" | "antigravity" | "n8n" | "codex" | "windsurf" | "aider" | "openhands" | "openclaw" | "hermes" | "pi" | "cline" | "roo-code" | "continue" | "claude-desktop" | "goose" | "open-webui" | "github-copilot" | "langgraph" | "muse-code" | "grok" | "opencode" | "dsh" | "xirp" | "agentic-orchestrator" | "langchain" | "crewai" | "autogen" | "ag2" | "google-adk" | "openai-agents" | "pydantic-ai" | "smolagents" | "strands" | "mastra" | "vercel-ai-sdk" | "eve" | "trueforge" | "ai-sdk-harness" | "ai-sdk-workflow" | "agentcore-runtime" | "trueforge-server";
|
|
368
458
|
files: {
|
|
369
459
|
path: string;
|
|
370
460
|
content: string;
|
package/dist/sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG/D,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAK7C,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,WAAW,EAAE,MAAM,CA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AAC/D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU9B,CAAA;AAEF,gDAAgD;AAChD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB7B,CAAA;AAEF,4EAA4E;AAC5E,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ1C,CAAA"}
|
package/dist/sync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,6BAAuB;AACvB,yCAAwC;
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,6BAAuB;AACvB,yCAAwC;AAiNxC,wEAAwE;AAExE,+DAA+D;AAClD,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAC,CAAC,UAAU,CAAC,sBAAW,CAAC;IACtC,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC;QACtB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAG,cAAc;QACjD,aAAa,EAAE,OAAC,CAAC,M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;KAC3C,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAA;AAEF,4EAA4E;AAC/D,QAAA,+BAA+B,GAAG,OAAC,CAAC,MAAM,CAAC;IACtD,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAC,CAAC,UAAU,CAAC,sBAAW,CAAC;IACtC,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;QACnB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;KACnC,CAAC,CAAC;CACJ,CAAC,CAAA"}
|
package/dist/toon.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The TOON wire format — one encoder, one decoder, one place.
|
|
3
|
+
*
|
|
4
|
+
* TOON is a compact tabular encoding for large row arrays:
|
|
5
|
+
*
|
|
6
|
+
* ```
|
|
7
|
+
* TOON|col1,col2,...,colN
|
|
8
|
+
* val1|val2|...|valN
|
|
9
|
+
* val1|val2|...|valN
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* It is produced by the control plane (`routes/incidents.ts`, `routes/traces.ts`)
|
|
13
|
+
* and consumed by the dashboard and the CLI. Pipe-delimited rather than CSV so
|
|
14
|
+
* commas in values need no escaping, with column headers up front so an LLM
|
|
15
|
+
* reading a tool result gets type context, and a `TOON` sentinel so a decoder
|
|
16
|
+
* can tell the format apart from JSON.
|
|
17
|
+
*
|
|
18
|
+
* # Why this module exists at all
|
|
19
|
+
*
|
|
20
|
+
* It used to live in `services/control-plane/src/lib/toon.ts`, with the decoder
|
|
21
|
+
* hand-copied into `tools/cli/src/lib/api.ts` and `apps/dashboard/src/lib/api.ts`
|
|
22
|
+
* — three implementations of one wire format, bound together by a comment saying
|
|
23
|
+
* they must not diverge.
|
|
24
|
+
*
|
|
25
|
+
* That is not a hypothetical risk; it already cost a live bug. `escapeCell`
|
|
26
|
+
* escaped `|` and newlines without escaping the backslash first, so a cell ending
|
|
27
|
+
* in `\` escaped the delimiter the encoder appended after it and merged with the
|
|
28
|
+
* next cell. On a governance incident from `GET /api/v1/incidents` that reads:
|
|
29
|
+
*
|
|
30
|
+
* severity "CRITICAL" -> "tr_…" (the trace id)
|
|
31
|
+
* workspace_id "ws_…" -> null
|
|
32
|
+
*
|
|
33
|
+
* so the row stopped rendering and filtering as CRITICAL in the dashboard and
|
|
34
|
+
* printing as CRITICAL in the CLI, for any holder of a workspace API key. It also
|
|
35
|
+
* corrupted ordinary data with no attacker present: a Windows path `C:\new` had
|
|
36
|
+
* its `\n` turned into a real newline.
|
|
37
|
+
*
|
|
38
|
+
* The repair was applied to the encoder and to the control plane's own decoder —
|
|
39
|
+
* and **nothing in the control plane decodes TOON**. The two decoders on the read
|
|
40
|
+
* path kept their private copies, so the exploit still reproduced end to end
|
|
41
|
+
* afterwards, and the half-fix additionally made a benign mid-string backslash
|
|
42
|
+
* render doubled. Consolidating here is what stops the next fix landing in one
|
|
43
|
+
* copy of three.
|
|
44
|
+
*
|
|
45
|
+
* # What is deliberately NOT here
|
|
46
|
+
*
|
|
47
|
+
* `toonEncodeWithMetrics` stays in the control plane. It calls
|
|
48
|
+
* `Buffer.byteLength`, and this module is imported by the dashboard's browser
|
|
49
|
+
* bundle — a Node built-in in here would work only for as long as tree-shaking
|
|
50
|
+
* happened to drop it, which is the kind of guarantee that fails silently. The
|
|
51
|
+
* wire format is universal; the byte accounting is a server concern.
|
|
52
|
+
*
|
|
53
|
+
* @module
|
|
54
|
+
*/
|
|
55
|
+
/** Minimum number of rows before TOON encoding activates. */
|
|
56
|
+
export declare const TOON_THRESHOLD_ROWS = 20;
|
|
57
|
+
/** Max characters per cell value before truncation. */
|
|
58
|
+
export declare const TOON_MAX_CELL_CHARS = 120;
|
|
59
|
+
/** Sentinel prefix for detecting TOON-encoded strings. */
|
|
60
|
+
export declare const TOON_MAGIC = "TOON";
|
|
61
|
+
/**
|
|
62
|
+
* A consistent ordered column set: the union of all keys, most common first.
|
|
63
|
+
*/
|
|
64
|
+
export declare function extractColumns(rows: Record<string, unknown>[]): string[];
|
|
65
|
+
/** Serialises one cell value to a compact, pipe-safe string. */
|
|
66
|
+
export declare function serializeCell(value: unknown): string;
|
|
67
|
+
/** Encodes an array of objects to TOON wire format. */
|
|
68
|
+
export declare function toonEncode(rows: Record<string, unknown>[], columns?: string[]): string;
|
|
69
|
+
/**
|
|
70
|
+
* Decodes a TOON string back to plain objects, or `null` if it is not TOON.
|
|
71
|
+
*/
|
|
72
|
+
export declare function toonDecode(toon: string): Record<string, unknown>[] | null;
|
|
73
|
+
export declare function shouldToon(rows: unknown[]): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Encodes a tool-result payload for context-window efficiency: TOON at or above
|
|
76
|
+
* {@link TOON_THRESHOLD_ROWS} rows, JSON below it.
|
|
77
|
+
*/
|
|
78
|
+
export declare function toonEncodeToolResult(toolName: string, rows: Record<string, unknown>[]): string;
|
|
79
|
+
export declare function toonDecodeToolResult(payload: string): Record<string, unknown>[] | null;
|
|
80
|
+
//# sourceMappingURL=toon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAIH,6DAA6D;AAC7D,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC,0DAA0D;AAC1D,eAAO,MAAM,UAAU,SAAS,CAAA;AAIhC;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,CAUxE;AAqCD,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CASpD;AAED,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAQtF;AAuCD;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CA6BzE;AAID,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAEnD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAC9B,MAAM,CAGR;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAStF"}
|
package/dist/toon.js
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The TOON wire format — one encoder, one decoder, one place.
|
|
4
|
+
*
|
|
5
|
+
* TOON is a compact tabular encoding for large row arrays:
|
|
6
|
+
*
|
|
7
|
+
* ```
|
|
8
|
+
* TOON|col1,col2,...,colN
|
|
9
|
+
* val1|val2|...|valN
|
|
10
|
+
* val1|val2|...|valN
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* It is produced by the control plane (`routes/incidents.ts`, `routes/traces.ts`)
|
|
14
|
+
* and consumed by the dashboard and the CLI. Pipe-delimited rather than CSV so
|
|
15
|
+
* commas in values need no escaping, with column headers up front so an LLM
|
|
16
|
+
* reading a tool result gets type context, and a `TOON` sentinel so a decoder
|
|
17
|
+
* can tell the format apart from JSON.
|
|
18
|
+
*
|
|
19
|
+
* # Why this module exists at all
|
|
20
|
+
*
|
|
21
|
+
* It used to live in `services/control-plane/src/lib/toon.ts`, with the decoder
|
|
22
|
+
* hand-copied into `tools/cli/src/lib/api.ts` and `apps/dashboard/src/lib/api.ts`
|
|
23
|
+
* — three implementations of one wire format, bound together by a comment saying
|
|
24
|
+
* they must not diverge.
|
|
25
|
+
*
|
|
26
|
+
* That is not a hypothetical risk; it already cost a live bug. `escapeCell`
|
|
27
|
+
* escaped `|` and newlines without escaping the backslash first, so a cell ending
|
|
28
|
+
* in `\` escaped the delimiter the encoder appended after it and merged with the
|
|
29
|
+
* next cell. On a governance incident from `GET /api/v1/incidents` that reads:
|
|
30
|
+
*
|
|
31
|
+
* severity "CRITICAL" -> "tr_…" (the trace id)
|
|
32
|
+
* workspace_id "ws_…" -> null
|
|
33
|
+
*
|
|
34
|
+
* so the row stopped rendering and filtering as CRITICAL in the dashboard and
|
|
35
|
+
* printing as CRITICAL in the CLI, for any holder of a workspace API key. It also
|
|
36
|
+
* corrupted ordinary data with no attacker present: a Windows path `C:\new` had
|
|
37
|
+
* its `\n` turned into a real newline.
|
|
38
|
+
*
|
|
39
|
+
* The repair was applied to the encoder and to the control plane's own decoder —
|
|
40
|
+
* and **nothing in the control plane decodes TOON**. The two decoders on the read
|
|
41
|
+
* path kept their private copies, so the exploit still reproduced end to end
|
|
42
|
+
* afterwards, and the half-fix additionally made a benign mid-string backslash
|
|
43
|
+
* render doubled. Consolidating here is what stops the next fix landing in one
|
|
44
|
+
* copy of three.
|
|
45
|
+
*
|
|
46
|
+
* # What is deliberately NOT here
|
|
47
|
+
*
|
|
48
|
+
* `toonEncodeWithMetrics` stays in the control plane. It calls
|
|
49
|
+
* `Buffer.byteLength`, and this module is imported by the dashboard's browser
|
|
50
|
+
* bundle — a Node built-in in here would work only for as long as tree-shaking
|
|
51
|
+
* happened to drop it, which is the kind of guarantee that fails silently. The
|
|
52
|
+
* wire format is universal; the byte accounting is a server concern.
|
|
53
|
+
*
|
|
54
|
+
* @module
|
|
55
|
+
*/
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.TOON_MAGIC = exports.TOON_MAX_CELL_CHARS = exports.TOON_THRESHOLD_ROWS = void 0;
|
|
58
|
+
exports.extractColumns = extractColumns;
|
|
59
|
+
exports.serializeCell = serializeCell;
|
|
60
|
+
exports.toonEncode = toonEncode;
|
|
61
|
+
exports.toonDecode = toonDecode;
|
|
62
|
+
exports.shouldToon = shouldToon;
|
|
63
|
+
exports.toonEncodeToolResult = toonEncodeToolResult;
|
|
64
|
+
exports.toonDecodeToolResult = toonDecodeToolResult;
|
|
65
|
+
// ── Configuration ───────────────────────────────────────────────────────────
|
|
66
|
+
/** Minimum number of rows before TOON encoding activates. */
|
|
67
|
+
exports.TOON_THRESHOLD_ROWS = 20;
|
|
68
|
+
/** Max characters per cell value before truncation. */
|
|
69
|
+
exports.TOON_MAX_CELL_CHARS = 120;
|
|
70
|
+
/** Sentinel prefix for detecting TOON-encoded strings. */
|
|
71
|
+
exports.TOON_MAGIC = 'TOON';
|
|
72
|
+
// ── Encoder ─────────────────────────────────────────────────────────────────
|
|
73
|
+
/**
|
|
74
|
+
* A consistent ordered column set: the union of all keys, most common first.
|
|
75
|
+
*/
|
|
76
|
+
function extractColumns(rows) {
|
|
77
|
+
const freq = new Map();
|
|
78
|
+
for (const row of rows) {
|
|
79
|
+
for (const key of Object.keys(row)) {
|
|
80
|
+
freq.set(key, (freq.get(key) ?? 0) + 1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return [...freq.entries()]
|
|
84
|
+
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
|
|
85
|
+
.map(([k]) => k);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Escapes a cell body so nothing in it can be mistaken for structure.
|
|
89
|
+
*
|
|
90
|
+
* **The backslash is escaped first, and that ordering is the whole point.**
|
|
91
|
+
* Escaping `|` and `\n` while passing the backslash through means a value ending
|
|
92
|
+
* in one escapes the delimiter the encoder appends after it: `x\` + `|` + `y`
|
|
93
|
+
* decodes as the single cell `x|y`, every later column shifts one place left, and
|
|
94
|
+
* the last decodes as null. Repeating the trailing backslash shifts further.
|
|
95
|
+
*
|
|
96
|
+
* The value is reachable without an attacker: `routes/incidents.ts` builds
|
|
97
|
+
* `description` from a hook event's `reason`, which any holder of a workspace API
|
|
98
|
+
* key sets on `POST /api/v1/hook-events`.
|
|
99
|
+
*/
|
|
100
|
+
function escapeCell(s) {
|
|
101
|
+
return s.replace(/\\/g, '\\\\').replace(/\|/g, '\\|').replace(/\n/g, '\\n');
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Truncates an already-escaped cell without severing an escape pair.
|
|
105
|
+
*
|
|
106
|
+
* `slice()` counts characters, not escape sequences, so a naive cut can land
|
|
107
|
+
* between a backslash and the character it escapes and leave a dangling backslash
|
|
108
|
+
* at the end of the cell — reintroducing the delimiter-swallowing bug through the
|
|
109
|
+
* back door. A trailing run of backslashes is even by construction (each came
|
|
110
|
+
* from `\\`), so an odd count means the cut split a pair.
|
|
111
|
+
*/
|
|
112
|
+
function truncateEscaped(escaped) {
|
|
113
|
+
if (escaped.length <= exports.TOON_MAX_CELL_CHARS)
|
|
114
|
+
return escaped;
|
|
115
|
+
let cut = escaped.slice(0, exports.TOON_MAX_CELL_CHARS);
|
|
116
|
+
let trailing = 0;
|
|
117
|
+
while (trailing < cut.length && cut[cut.length - 1 - trailing] === '\\')
|
|
118
|
+
trailing++;
|
|
119
|
+
if (trailing % 2 === 1)
|
|
120
|
+
cut = cut.slice(0, -1);
|
|
121
|
+
return cut + '\u2026';
|
|
122
|
+
}
|
|
123
|
+
/** Serialises one cell value to a compact, pipe-safe string. */
|
|
124
|
+
function serializeCell(value) {
|
|
125
|
+
if (value === null || value === undefined)
|
|
126
|
+
return '-';
|
|
127
|
+
if (typeof value === 'boolean')
|
|
128
|
+
return value ? 't' : 'f';
|
|
129
|
+
if (typeof value === 'number')
|
|
130
|
+
return String(value);
|
|
131
|
+
if (typeof value === 'string')
|
|
132
|
+
return truncateEscaped(escapeCell(value));
|
|
133
|
+
// `JSON.stringify` escapes backslashes and newlines *within* the JSON string
|
|
134
|
+
// literals it emits, but the result is still a plain string that can end in a
|
|
135
|
+
// backslash (`{"p":"C:\\"}`), so it goes through the same escaper.
|
|
136
|
+
return truncateEscaped(escapeCell(JSON.stringify(value)));
|
|
137
|
+
}
|
|
138
|
+
/** Encodes an array of objects to TOON wire format. */
|
|
139
|
+
function toonEncode(rows, columns) {
|
|
140
|
+
if (rows.length === 0)
|
|
141
|
+
return `${exports.TOON_MAGIC}|(empty)\n`;
|
|
142
|
+
const cols = columns ?? extractColumns(rows);
|
|
143
|
+
const lines = [`${exports.TOON_MAGIC}|${cols.join(',')}`];
|
|
144
|
+
for (const row of rows) {
|
|
145
|
+
lines.push(cols.map((col) => serializeCell(row[col])).join('|'));
|
|
146
|
+
}
|
|
147
|
+
return lines.join('\n') + '\n';
|
|
148
|
+
}
|
|
149
|
+
// ── Decoder ─────────────────────────────────────────────────────────────────
|
|
150
|
+
/**
|
|
151
|
+
* Splits one encoded row into cells, unescaping as it goes.
|
|
152
|
+
*
|
|
153
|
+
* A single left-to-right pass, not a chain of `.replace()` calls. The decoder
|
|
154
|
+
* this replaces swapped `\|` for a NUL placeholder before splitting, which cannot
|
|
155
|
+
* express the `\\` that {@link escapeCell} emits: given `x\\|y` the regex pairs
|
|
156
|
+
* the *second* backslash with the delimiter and swallows it, merging two cells —
|
|
157
|
+
* the exact bug the encoder change closes. Scanning is the only way the two
|
|
158
|
+
* escapes stay distinguishable.
|
|
159
|
+
*
|
|
160
|
+
* A lone backslash before anything other than `\`, `|` or `n` is kept literal
|
|
161
|
+
* rather than dropped. That is deliberate: it is what a payload from a control
|
|
162
|
+
* plane predating the encoder fix looks like, and a stale value is a better
|
|
163
|
+
* failure than a discarded character.
|
|
164
|
+
*/
|
|
165
|
+
function splitCells(line) {
|
|
166
|
+
const cells = [];
|
|
167
|
+
let cur = '';
|
|
168
|
+
for (let i = 0; i < line.length; i++) {
|
|
169
|
+
const ch = line[i];
|
|
170
|
+
if (ch === '\\') {
|
|
171
|
+
const next = line[i + 1];
|
|
172
|
+
if (next === '\\') {
|
|
173
|
+
cur += '\\';
|
|
174
|
+
i++;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (next === '|') {
|
|
178
|
+
cur += '|';
|
|
179
|
+
i++;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (next === 'n') {
|
|
183
|
+
cur += '\n';
|
|
184
|
+
i++;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
cur += '\\';
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (ch === '|') {
|
|
191
|
+
cells.push(cur);
|
|
192
|
+
cur = '';
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
cur += ch;
|
|
196
|
+
}
|
|
197
|
+
cells.push(cur);
|
|
198
|
+
return cells;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Decodes a TOON string back to plain objects, or `null` if it is not TOON.
|
|
202
|
+
*/
|
|
203
|
+
function toonDecode(toon) {
|
|
204
|
+
const lines = toon.trimEnd().split('\n');
|
|
205
|
+
if (lines.length < 1)
|
|
206
|
+
return null;
|
|
207
|
+
const header = lines[0];
|
|
208
|
+
if (!header.startsWith(`${exports.TOON_MAGIC}|`))
|
|
209
|
+
return null;
|
|
210
|
+
const colsStr = header.slice(exports.TOON_MAGIC.length + 1);
|
|
211
|
+
if (colsStr === '(empty)')
|
|
212
|
+
return [];
|
|
213
|
+
const cols = colsStr.split(',');
|
|
214
|
+
const rows = [];
|
|
215
|
+
for (const line of lines.slice(1)) {
|
|
216
|
+
if (!line.trim())
|
|
217
|
+
continue;
|
|
218
|
+
const cells = splitCells(line);
|
|
219
|
+
const obj = {};
|
|
220
|
+
for (let i = 0; i < cols.length; i++) {
|
|
221
|
+
const key = cols[i];
|
|
222
|
+
const raw = cells[i] ?? '-';
|
|
223
|
+
if (raw === '-') {
|
|
224
|
+
obj[key] = null;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (raw === 't') {
|
|
228
|
+
obj[key] = true;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
if (raw === 'f') {
|
|
232
|
+
obj[key] = false;
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
const num = Number(raw);
|
|
236
|
+
if (!isNaN(num) && raw !== '') {
|
|
237
|
+
obj[key] = num;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (raw.startsWith('{') || raw.startsWith('[')) {
|
|
241
|
+
try {
|
|
242
|
+
obj[key] = JSON.parse(raw);
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
catch { /* fall through */ }
|
|
246
|
+
}
|
|
247
|
+
obj[key] = raw;
|
|
248
|
+
}
|
|
249
|
+
rows.push(obj);
|
|
250
|
+
}
|
|
251
|
+
return rows;
|
|
252
|
+
}
|
|
253
|
+
// ── Threshold-gated encode ──────────────────────────────────────────────────
|
|
254
|
+
function shouldToon(rows) {
|
|
255
|
+
return rows.length >= exports.TOON_THRESHOLD_ROWS;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Encodes a tool-result payload for context-window efficiency: TOON at or above
|
|
259
|
+
* {@link TOON_THRESHOLD_ROWS} rows, JSON below it.
|
|
260
|
+
*/
|
|
261
|
+
function toonEncodeToolResult(toolName, rows) {
|
|
262
|
+
if (!shouldToon(rows))
|
|
263
|
+
return JSON.stringify(rows);
|
|
264
|
+
return `# ${toolName} [${rows.length} rows, TOON-compressed]\n` + toonEncode(rows);
|
|
265
|
+
}
|
|
266
|
+
function toonDecodeToolResult(payload) {
|
|
267
|
+
const body = payload.replace(/^#[^\n]*\n/, '');
|
|
268
|
+
if (body.startsWith(`${exports.TOON_MAGIC}|`))
|
|
269
|
+
return toonDecode(body);
|
|
270
|
+
try {
|
|
271
|
+
const parsed = JSON.parse(body);
|
|
272
|
+
return Array.isArray(parsed) ? parsed : null;
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=toon.js.map
|
package/dist/toon.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toon.js","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;;;AAkBH,wCAUC;AAsCD,sCASC;AAGD,gCAQC;AA0CD,gCA6BC;AAID,gCAEC;AAMD,oDAMC;AAED,oDASC;AAxLD,+EAA+E;AAE/E,6DAA6D;AAChD,QAAA,mBAAmB,GAAG,EAAE,CAAA;AAErC,uDAAuD;AAC1C,QAAA,mBAAmB,GAAG,GAAG,CAAA;AAEtC,0DAA0D;AAC7C,QAAA,UAAU,GAAG,MAAM,CAAA;AAEhC,+EAA+E;AAE/E;;GAEG;AACH,SAAgB,cAAc,CAAC,IAA+B;IAC5D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAA;IACtC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;SACvB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE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AAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
package/dist/usage.d.ts
CHANGED
|
@@ -31,4 +31,27 @@ export interface ModelBreakdown {
|
|
|
31
31
|
totalOutputTokens: number;
|
|
32
32
|
traceCount: number;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Per-virtual-key cost breakdown (`GET /api/v1/usage/virtual-keys`).
|
|
36
|
+
*
|
|
37
|
+
* "Desktop vs. app" and similar traffic-class splits work today by minting
|
|
38
|
+
* one virtual key per class and pointing that traffic at it — this is the
|
|
39
|
+
* meter that makes those separate keys actually read as separate cost
|
|
40
|
+
* figures. Same shape as {@link ModelBreakdown}, grouped by key instead of
|
|
41
|
+
* model. See migration 174.
|
|
42
|
+
*/
|
|
43
|
+
export interface VirtualKeyBreakdown {
|
|
44
|
+
/**
|
|
45
|
+
* The key's non-secret key_prefix — `null` groups every trace with no
|
|
46
|
+
* virtual-key auth context (standalone/offline traces synced back, or any
|
|
47
|
+
* trace older than migration 174), never invented as `'unknown'` inline
|
|
48
|
+
* with a real prefix.
|
|
49
|
+
*/
|
|
50
|
+
virtualKeyId: string | null;
|
|
51
|
+
totalCostUsd: number;
|
|
52
|
+
totalRawCostUsd: number;
|
|
53
|
+
totalInputTokens: number;
|
|
54
|
+
totalOutputTokens: number;
|
|
55
|
+
traceCount: number;
|
|
56
|
+
}
|
|
34
57
|
//# sourceMappingURL=usage.d.ts.map
|
package/dist/usage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../src/usage.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAA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