@artemiskit/core 0.5.3 → 0.6.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.
- package/CHANGELOG.md +28 -0
- package/README.md +12 -0
- package/dist/adapters/factory.d.ts +1 -1
- package/dist/adapters/index.d.ts +3 -3
- package/dist/adapters/registry.d.ts +1 -1
- package/dist/adapters/types.d.ts +7 -0
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/agent-evaluation/index.d.ts +2 -2
- package/dist/agent-evaluation/scorer.d.ts +1 -1
- package/dist/agent-workflow/catalog.d.ts +28 -0
- package/dist/agent-workflow/catalog.d.ts.map +1 -0
- package/dist/agent-workflow/environment.d.ts +47 -0
- package/dist/agent-workflow/environment.d.ts.map +1 -0
- package/dist/agent-workflow/index.d.ts +10 -0
- package/dist/agent-workflow/index.d.ts.map +1 -0
- package/dist/agent-workflow/parser.d.ts +7 -0
- package/dist/agent-workflow/parser.d.ts.map +1 -0
- package/dist/agent-workflow/sandbox-fixtures/qualify.d.ts +2 -0
- package/dist/agent-workflow/sandbox-fixtures/qualify.d.ts.map +1 -0
- package/dist/agent-workflow/sandbox.d.ts +12 -0
- package/dist/agent-workflow/sandbox.d.ts.map +1 -0
- package/dist/agent-workflow/schema.d.ts +774 -0
- package/dist/agent-workflow/schema.d.ts.map +1 -0
- package/dist/agent-workflow/session.d.ts +113 -0
- package/dist/agent-workflow/session.d.ts.map +1 -0
- package/dist/agent-workflow/simulated-tools.d.ts +35 -0
- package/dist/agent-workflow/simulated-tools.d.ts.map +1 -0
- package/dist/agent-workflow/target.d.ts +243 -0
- package/dist/agent-workflow/target.d.ts.map +1 -0
- package/dist/artifacts/index.d.ts +2 -2
- package/dist/artifacts/manifest.d.ts +1 -1
- package/dist/artifacts/types.d.ts +2 -2
- package/dist/comparison/eligibility.d.ts +1 -1
- package/dist/comparison/index.d.ts +1 -1
- package/dist/evaluators/combined.d.ts +2 -2
- package/dist/evaluators/contains.d.ts +2 -2
- package/dist/evaluators/exact.d.ts +2 -2
- package/dist/evaluators/fuzzy.d.ts +2 -2
- package/dist/evaluators/index.d.ts +13 -13
- package/dist/evaluators/inline.d.ts +2 -2
- package/dist/evaluators/json-schema.d.ts +2 -2
- package/dist/evaluators/llm-grader.d.ts +2 -2
- package/dist/evaluators/not-contains.d.ts +2 -2
- package/dist/evaluators/regex.d.ts +2 -2
- package/dist/evaluators/similarity.d.ts +2 -2
- package/dist/evaluators/tool-trace.d.ts +2 -2
- package/dist/evaluators/types.d.ts +3 -3
- package/dist/index.d.ts +15 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17827 -15174
- package/dist/provenance/execution-provenance.d.ts +1 -1
- package/dist/provenance/git.d.ts +1 -1
- package/dist/provenance/index.d.ts +4 -4
- package/dist/provenance/workload-identity.d.ts +2 -2
- package/dist/redaction/index.d.ts +2 -2
- package/dist/redaction/redactor.d.ts +1 -1
- package/dist/runner/executor.d.ts +3 -3
- package/dist/runner/index.d.ts +3 -3
- package/dist/runner/runner.d.ts +1 -1
- package/dist/runner/types.d.ts +5 -5
- package/dist/scenario/index.d.ts +4 -4
- package/dist/scenario/parser.d.ts +1 -1
- package/dist/scenario/variables.d.ts +1 -1
- package/dist/storage/factory.d.ts +1 -1
- package/dist/storage/index.d.ts +4 -4
- package/dist/storage/local.d.ts +2 -2
- package/dist/storage/supabase.d.ts +2 -2
- package/dist/storage/types.d.ts +2 -2
- package/dist/tools/fixture-executor.d.ts +2 -2
- package/dist/tools/index.d.ts +3 -3
- package/dist/tools/types.d.ts +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/validator/index.d.ts +2 -2
- package/dist/validator/validator.d.ts +1 -1
- package/package.json +4 -4
- package/src/adapters/types.ts +7 -0
- package/src/agent-workflow/catalog.ts +220 -0
- package/src/agent-workflow/environment.ts +207 -0
- package/src/agent-workflow/index.ts +10 -0
- package/src/agent-workflow/parser.ts +43 -0
- package/src/agent-workflow/sandbox-fixtures/qualify.ts +305 -0
- package/src/agent-workflow/sandbox.test.ts +117 -0
- package/src/agent-workflow/sandbox.ts +438 -0
- package/src/agent-workflow/schema.test.ts +218 -0
- package/src/agent-workflow/schema.ts +270 -0
- package/src/agent-workflow/session.test.ts +629 -0
- package/src/agent-workflow/session.ts +1119 -0
- package/src/agent-workflow/simulated-tools.test.ts +177 -0
- package/src/agent-workflow/simulated-tools.ts +230 -0
- package/src/agent-workflow/target.test.ts +280 -0
- package/src/agent-workflow/target.ts +357 -0
- package/src/index.ts +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Bounded execution provenance derived from declared and observed run evidence. */
|
|
2
|
-
import type { CaseResult, ExecutionProvenance } from '../artifacts/types';
|
|
2
|
+
import type { CaseResult, ExecutionProvenance } from '../artifacts/types.js';
|
|
3
3
|
export declare function createExecutionProvenance(options: {
|
|
4
4
|
provider: string;
|
|
5
5
|
requestedModel?: string;
|
package/dist/provenance/git.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provenance module exports
|
|
3
3
|
*/
|
|
4
|
-
export { getGitInfo } from './git';
|
|
5
|
-
export { getEnvironmentInfo } from './environment';
|
|
6
|
-
export { createWorkloadIdentity } from './workload-identity';
|
|
7
|
-
export { createExecutionProvenance } from './execution-provenance';
|
|
4
|
+
export { getGitInfo } from './git.js';
|
|
5
|
+
export { getEnvironmentInfo } from './environment.js';
|
|
6
|
+
export { createWorkloadIdentity } from './workload-identity.js';
|
|
7
|
+
export { createExecutionProvenance } from './execution-provenance.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Canonical, redacted workload identities for reproducible assessment evidence.
|
|
3
3
|
*/
|
|
4
|
-
import type { WorkloadIdentity } from '../artifacts/types';
|
|
5
|
-
import type { Scenario } from '../scenario/schema';
|
|
4
|
+
import type { WorkloadIdentity } from '../artifacts/types.js';
|
|
5
|
+
import type { Scenario } from '../scenario/schema.js';
|
|
6
6
|
/**
|
|
7
7
|
* Create independent identities for the declared workload and its evaluation
|
|
8
8
|
* criteria. Input is sorted, redacted, and hashed locally; raw material is
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { BUILTIN_PATTERNS, BUILTIN_REGEX_PATTERNS, DEFAULT_REDACTION_PATTERNS, RedactionConfigSchema, type BuiltinPatternName, type CaseRedactionDetails, type RedactionConfig, type RedactionMetadata, type RedactionOptions, type RedactionResult, } from './types';
|
|
2
|
-
export { Redactor, createDefaultRedactor, createNoOpRedactor, createRedactionOptions, hashText, redactText, redactWithHash, resolvePatterns, } from './redactor';
|
|
1
|
+
export { BUILTIN_PATTERNS, BUILTIN_REGEX_PATTERNS, DEFAULT_REDACTION_PATTERNS, RedactionConfigSchema, type BuiltinPatternName, type CaseRedactionDetails, type RedactionConfig, type RedactionMetadata, type RedactionOptions, type RedactionResult, } from './types.js';
|
|
2
|
+
export { Redactor, createDefaultRedactor, createNoOpRedactor, createRedactionOptions, hashText, redactText, redactWithHash, resolvePatterns, } from './redactor.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RedactionConfig, type RedactionOptions, type RedactionResult } from './types';
|
|
1
|
+
import { type RedactionConfig, type RedactionOptions, type RedactionResult } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Resolve pattern strings to RegExp objects
|
|
4
4
|
* Supports built-in pattern names and custom regex strings
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Test case executor
|
|
3
3
|
*/
|
|
4
|
-
import type { CaseResult } from '../artifacts/types';
|
|
5
|
-
import type { TestCase } from '../scenario/schema';
|
|
6
|
-
import type { ExecutorContext } from './types';
|
|
4
|
+
import type { CaseResult } from '../artifacts/types.js';
|
|
5
|
+
import type { TestCase } from '../scenario/schema.js';
|
|
6
|
+
import type { ExecutorContext } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Execute a single test case
|
|
9
9
|
*/
|
package/dist/runner/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runner module exports
|
|
3
3
|
*/
|
|
4
|
-
export * from './types';
|
|
5
|
-
export { executeCase } from './executor';
|
|
6
|
-
export { runScenario, runScenarios } from './runner';
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export { executeCase } from './executor.js';
|
|
6
|
+
export { runScenario, runScenarios } from './runner.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/runner/runner.d.ts
CHANGED
package/dist/runner/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runner types and interfaces
|
|
3
3
|
*/
|
|
4
|
-
import type { ModelClient } from '../adapters/types';
|
|
5
|
-
import type { CaseResult, CostProvenance, ResolvedConfig, RunManifest } from '../artifacts/types';
|
|
6
|
-
import type { RedactionConfig } from '../redaction/types';
|
|
7
|
-
import type { Scenario } from '../scenario/schema';
|
|
8
|
-
import type { ToolExecutor } from '../tools';
|
|
4
|
+
import type { ModelClient } from '../adapters/types.js';
|
|
5
|
+
import type { CaseResult, CostProvenance, ResolvedConfig, RunManifest } from '../artifacts/types.js';
|
|
6
|
+
import type { RedactionConfig } from '../redaction/types.js';
|
|
7
|
+
import type { Scenario } from '../scenario/schema.js';
|
|
8
|
+
import type { ToolExecutor } from '../tools/index.js';
|
|
9
9
|
/**
|
|
10
10
|
* Options for running a scenario
|
|
11
11
|
*/
|
package/dist/scenario/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Scenario module exports
|
|
3
3
|
*/
|
|
4
|
-
export * from './schema';
|
|
5
|
-
export * from './parser';
|
|
6
|
-
export * from './variables';
|
|
7
|
-
export * from './discovery';
|
|
4
|
+
export * from './schema.js';
|
|
5
|
+
export * from './parser.js';
|
|
6
|
+
export * from './variables.js';
|
|
7
|
+
export * from './discovery.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Storage module exports
|
|
3
3
|
*/
|
|
4
|
-
export * from './types';
|
|
5
|
-
export { createStorageAdapter, createStorageFromEnv } from './factory';
|
|
6
|
-
export { SupabaseStorageAdapter, type SupabaseStorageConfig } from './supabase';
|
|
7
|
-
export { LocalStorageAdapter } from './local';
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export { createStorageAdapter, createStorageFromEnv } from './factory.js';
|
|
6
|
+
export { SupabaseStorageAdapter, type SupabaseStorageConfig } from './supabase.js';
|
|
7
|
+
export { LocalStorageAdapter } from './local.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/storage/local.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Local filesystem storage adapter
|
|
3
3
|
*/
|
|
4
|
-
import { type AnyManifest, type RedTeamManifest, type RunManifest, type StressManifest } from '../artifacts/types';
|
|
5
|
-
import type { BaselineMetadata, BaselineStorageAdapter, ComparisonResult, ListOptions, RunListItem } from './types';
|
|
4
|
+
import { type AnyManifest, type RedTeamManifest, type RunManifest, type StressManifest } from '../artifacts/types.js';
|
|
5
|
+
import type { BaselineMetadata, BaselineStorageAdapter, ComparisonResult, ListOptions, RunListItem } from './types.js';
|
|
6
6
|
export declare class LocalStorageAdapter implements BaselineStorageAdapter {
|
|
7
7
|
private basePath;
|
|
8
8
|
private baselinesPath;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Supabase storage adapter with analytics capabilities
|
|
3
3
|
*/
|
|
4
|
-
import { type RunManifest } from '../artifacts/types';
|
|
5
|
-
import type { AnalyticsStorageAdapter, BaselineMetadata, CaseResultQueryOptions, CaseResultRecord, ComparisonResult, ListOptions, MetricsSnapshot, MetricsTrendOptions, RunListItem, TrendDataPoint } from './types';
|
|
4
|
+
import { type RunManifest } from '../artifacts/types.js';
|
|
5
|
+
import type { AnalyticsStorageAdapter, BaselineMetadata, CaseResultQueryOptions, CaseResultRecord, ComparisonResult, ListOptions, MetricsSnapshot, MetricsTrendOptions, RunListItem, TrendDataPoint } from './types.js';
|
|
6
6
|
export interface SupabaseStorageConfig {
|
|
7
7
|
url: string;
|
|
8
8
|
anonKey: string;
|
package/dist/storage/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Storage types and interfaces
|
|
3
3
|
*/
|
|
4
|
-
import type { AnyManifest, CaseEvaluationEvidence, RedTeamManifest, RunManifest, StressManifest } from '../artifacts/types';
|
|
5
|
-
import type { ComparisonEligibility } from '../comparison';
|
|
4
|
+
import type { AnyManifest, CaseEvaluationEvidence, RedTeamManifest, RunManifest, StressManifest } from '../artifacts/types.js';
|
|
5
|
+
import type { ComparisonEligibility } from '../comparison/index.js';
|
|
6
6
|
/**
|
|
7
7
|
* Run listing item
|
|
8
8
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ToolCall } from '../adapters/types';
|
|
2
|
-
import type { FixtureExecutorOptions, ToolExecutionContext, ToolExecutionResult } from './types';
|
|
1
|
+
import type { ToolCall } from '../adapters/types.js';
|
|
2
|
+
import type { FixtureExecutorOptions, ToolExecutionContext, ToolExecutionResult } from './types.js';
|
|
3
3
|
export declare class FixtureToolExecutor {
|
|
4
4
|
private readonly tools;
|
|
5
5
|
private readonly fixtures;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './fixture-executor';
|
|
2
|
-
export * from './schema-validator';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './fixture-executor.js';
|
|
2
|
+
export * from './schema-validator.js';
|
|
3
|
+
export * from './types.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolCall, ToolDefinition } from '../adapters/types';
|
|
1
|
+
import type { ToolCall, ToolDefinition } from '../adapters/types.js';
|
|
2
2
|
export type ToolLoopTerminationReason = 'completed' | 'max_steps' | 'timeout' | 'duplicate_call' | 'invalid_arguments' | 'unknown_tool' | 'tool_error';
|
|
3
3
|
export interface ToolLoopPolicy {
|
|
4
4
|
enabled: boolean;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 3. Semantic errors (duplicate IDs, undefined variables)
|
|
8
8
|
* 4. Warnings (deprecated patterns)
|
|
9
9
|
*/
|
|
10
|
-
import type { ValidationResult, ValidatorOptions } from './types';
|
|
10
|
+
import type { ValidationResult, ValidatorOptions } from './types.js';
|
|
11
11
|
/**
|
|
12
12
|
* Scenario validator class
|
|
13
13
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artemiskit/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Core runner, evaluators, and storage for ArtemisKit LLM evaluation toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"types": "./dist/index.d.ts",
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "tsc --emitDeclarationOnly && bun build ./src/index.ts --outdir ./dist --target
|
|
38
|
+
"build": "tsc --emitDeclarationOnly && bun build ./src/index.ts --outdir ./dist --target node --external '@artemiskit/*' && node ../../scripts/finalize-declarations.mjs ./dist",
|
|
39
39
|
"typecheck": "tsc --noEmit",
|
|
40
40
|
"clean": "rm -rf dist",
|
|
41
41
|
"test": "bun test"
|
package/src/adapters/types.ts
CHANGED
|
@@ -31,6 +31,10 @@ export interface ToolCall {
|
|
|
31
31
|
* Options for generating a completion
|
|
32
32
|
*/
|
|
33
33
|
export interface GenerateOptions {
|
|
34
|
+
/** Optional transport cancellation; consult capabilities before relying on it. */
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
/** Override retries per request when a host owns cumulative admission budgets. */
|
|
37
|
+
maxRetries?: number;
|
|
34
38
|
prompt: string | ChatMessage[];
|
|
35
39
|
model?: string;
|
|
36
40
|
maxTokens?: number;
|
|
@@ -78,6 +82,8 @@ export interface TokenUsage {
|
|
|
78
82
|
* Result from a generation request
|
|
79
83
|
*/
|
|
80
84
|
export interface GenerateResult {
|
|
85
|
+
/** False when zero counts are placeholders rather than provider-reported usage. */
|
|
86
|
+
usageAvailable?: boolean;
|
|
81
87
|
id: string;
|
|
82
88
|
model: string;
|
|
83
89
|
text: string;
|
|
@@ -96,6 +102,7 @@ export interface GenerateResult {
|
|
|
96
102
|
* Model capabilities
|
|
97
103
|
*/
|
|
98
104
|
export interface ModelCapabilities {
|
|
105
|
+
transportCancellation?: boolean;
|
|
99
106
|
streaming: boolean;
|
|
100
107
|
functionCalling: boolean;
|
|
101
108
|
toolUse: boolean;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/** Versioned run-local capabilities shared by simulated and disposable sandbox environments. */
|
|
2
|
+
export const WORKFLOW_TOOL_IDS = [
|
|
3
|
+
'search',
|
|
4
|
+
'read_document',
|
|
5
|
+
'query_records',
|
|
6
|
+
'read_file',
|
|
7
|
+
'write_file',
|
|
8
|
+
'calculator',
|
|
9
|
+
'get_workflow_state',
|
|
10
|
+
'request_approval',
|
|
11
|
+
'record_decision',
|
|
12
|
+
'draft_message',
|
|
13
|
+
'delegate_task',
|
|
14
|
+
'get_task_status',
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
export type WorkflowToolId = (typeof WORKFLOW_TOOL_IDS)[number];
|
|
18
|
+
export type WorkflowResource =
|
|
19
|
+
| 'documents'
|
|
20
|
+
| 'records'
|
|
21
|
+
| 'files'
|
|
22
|
+
| 'computation'
|
|
23
|
+
| 'workflow_state'
|
|
24
|
+
| 'communication'
|
|
25
|
+
| 'coordination';
|
|
26
|
+
|
|
27
|
+
export interface WorkflowToolDescriptor {
|
|
28
|
+
id: WorkflowToolId;
|
|
29
|
+
version: '1';
|
|
30
|
+
family: string;
|
|
31
|
+
description: string;
|
|
32
|
+
inputSchema: Record<string, unknown>;
|
|
33
|
+
outputSchema: Record<string, unknown>;
|
|
34
|
+
authority: {
|
|
35
|
+
resource: WorkflowResource;
|
|
36
|
+
access: 'read' | 'write' | 'none';
|
|
37
|
+
network: 'denied';
|
|
38
|
+
/** V1's simulated label means run-local effects; file storage follows the selected environment. */
|
|
39
|
+
sideEffects: 'none' | 'simulated';
|
|
40
|
+
};
|
|
41
|
+
evidence: { mode: 'metadata_only'; maxBytes: 1024 };
|
|
42
|
+
failureModes: string[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const text = { type: 'string', minLength: 1, maxLength: 16_384 };
|
|
46
|
+
const identifier = {
|
|
47
|
+
type: 'string',
|
|
48
|
+
pattern: '^(?!(?:__proto__|prototype|constructor)$)[a-zA-Z0-9_-]{1,128}$',
|
|
49
|
+
};
|
|
50
|
+
const relativePath = {
|
|
51
|
+
type: 'string',
|
|
52
|
+
maxLength: 512,
|
|
53
|
+
pattern:
|
|
54
|
+
'^(?!.*(?:^|/)(?:\\.\\.?|__proto__|prototype|constructor)(?:/|$))[a-zA-Z0-9_-][a-zA-Z0-9_./-]*$',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
function object(properties: Record<string, unknown>, required = Object.keys(properties)) {
|
|
58
|
+
return { type: 'object', properties, required, additionalProperties: false };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function descriptor(
|
|
62
|
+
id: WorkflowToolId,
|
|
63
|
+
family: string,
|
|
64
|
+
description: string,
|
|
65
|
+
resource: WorkflowResource,
|
|
66
|
+
access: 'read' | 'write' | 'none',
|
|
67
|
+
inputSchema: Record<string, unknown>,
|
|
68
|
+
outputSchema: Record<string, unknown>
|
|
69
|
+
): WorkflowToolDescriptor {
|
|
70
|
+
return {
|
|
71
|
+
id,
|
|
72
|
+
version: '1',
|
|
73
|
+
family,
|
|
74
|
+
description,
|
|
75
|
+
inputSchema,
|
|
76
|
+
outputSchema,
|
|
77
|
+
authority: {
|
|
78
|
+
resource,
|
|
79
|
+
access,
|
|
80
|
+
network: 'denied',
|
|
81
|
+
sideEffects: access === 'write' ? 'simulated' : 'none',
|
|
82
|
+
},
|
|
83
|
+
evidence: { mode: 'metadata_only', maxBytes: 1024 },
|
|
84
|
+
failureModes: [
|
|
85
|
+
'undeclared_tool',
|
|
86
|
+
'permission_denied',
|
|
87
|
+
'invalid_policy',
|
|
88
|
+
'invalid_input',
|
|
89
|
+
'invalid_state',
|
|
90
|
+
'not_found',
|
|
91
|
+
'output_limit',
|
|
92
|
+
'tool_error',
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const tools: WorkflowToolDescriptor[] = [
|
|
98
|
+
descriptor(
|
|
99
|
+
'search',
|
|
100
|
+
'retrieval',
|
|
101
|
+
'Search declared documents by case-insensitive literal text.',
|
|
102
|
+
'documents',
|
|
103
|
+
'read',
|
|
104
|
+
object({ query: text }),
|
|
105
|
+
object({ matches: { type: 'array', maxItems: 100, items: object({ id: identifier }) } })
|
|
106
|
+
),
|
|
107
|
+
descriptor(
|
|
108
|
+
'read_document',
|
|
109
|
+
'documents',
|
|
110
|
+
'Read one document from simulated state.',
|
|
111
|
+
'documents',
|
|
112
|
+
'read',
|
|
113
|
+
object({ id: identifier }),
|
|
114
|
+
object({ id: identifier, content: { type: 'string', maxLength: 16_384 } })
|
|
115
|
+
),
|
|
116
|
+
descriptor(
|
|
117
|
+
'query_records',
|
|
118
|
+
'records',
|
|
119
|
+
'Read a bounded declared collection of structured records.',
|
|
120
|
+
'records',
|
|
121
|
+
'read',
|
|
122
|
+
object({ collection: identifier }),
|
|
123
|
+
object({ records: { type: 'array', maxItems: 100, items: { type: 'object' } } })
|
|
124
|
+
),
|
|
125
|
+
descriptor(
|
|
126
|
+
'read_file',
|
|
127
|
+
'files',
|
|
128
|
+
'Read one relative file from the isolated workflow environment.',
|
|
129
|
+
'files',
|
|
130
|
+
'read',
|
|
131
|
+
object({ path: relativePath }),
|
|
132
|
+
object({ content: { type: 'string', maxLength: 16_384 } })
|
|
133
|
+
),
|
|
134
|
+
descriptor(
|
|
135
|
+
'write_file',
|
|
136
|
+
'files',
|
|
137
|
+
'Write one relative file in the isolated workflow environment.',
|
|
138
|
+
'files',
|
|
139
|
+
'write',
|
|
140
|
+
object({ path: relativePath, content: { type: 'string', maxLength: 16_384 } }),
|
|
141
|
+
object({ path: relativePath, written: { const: true } })
|
|
142
|
+
),
|
|
143
|
+
descriptor(
|
|
144
|
+
'calculator',
|
|
145
|
+
'computation',
|
|
146
|
+
'Perform one finite arithmetic operation without evaluating code.',
|
|
147
|
+
'computation',
|
|
148
|
+
'none',
|
|
149
|
+
object({
|
|
150
|
+
operation: { enum: ['add', 'subtract', 'multiply', 'divide'] },
|
|
151
|
+
a: { type: 'number' },
|
|
152
|
+
b: { type: 'number' },
|
|
153
|
+
}),
|
|
154
|
+
object({ value: { type: 'number' } })
|
|
155
|
+
),
|
|
156
|
+
descriptor(
|
|
157
|
+
'get_workflow_state',
|
|
158
|
+
'workflow',
|
|
159
|
+
'Read declared workflow state.',
|
|
160
|
+
'workflow_state',
|
|
161
|
+
'read',
|
|
162
|
+
object({}),
|
|
163
|
+
object({ state: { type: 'object' } })
|
|
164
|
+
),
|
|
165
|
+
descriptor(
|
|
166
|
+
'request_approval',
|
|
167
|
+
'approvals',
|
|
168
|
+
'Record a pending simulated request; never grant approval.',
|
|
169
|
+
'workflow_state',
|
|
170
|
+
'write',
|
|
171
|
+
object({ reason: text }),
|
|
172
|
+
object({ requested: { const: true }, status: { const: 'pending' } })
|
|
173
|
+
),
|
|
174
|
+
descriptor(
|
|
175
|
+
'record_decision',
|
|
176
|
+
'workflow',
|
|
177
|
+
'Record a proposed decision without granting authority.',
|
|
178
|
+
'workflow_state',
|
|
179
|
+
'write',
|
|
180
|
+
object({ decision: text }),
|
|
181
|
+
object({ recorded: { const: true } })
|
|
182
|
+
),
|
|
183
|
+
descriptor(
|
|
184
|
+
'draft_message',
|
|
185
|
+
'communication',
|
|
186
|
+
'Create a local message draft; never send it.',
|
|
187
|
+
'communication',
|
|
188
|
+
'write',
|
|
189
|
+
object({ recipient: text, body: text }),
|
|
190
|
+
object({ id: identifier, status: { const: 'draft' } })
|
|
191
|
+
),
|
|
192
|
+
descriptor(
|
|
193
|
+
'delegate_task',
|
|
194
|
+
'coordination',
|
|
195
|
+
'Record a pending local task; never invoke a worker or external system.',
|
|
196
|
+
'coordination',
|
|
197
|
+
'write',
|
|
198
|
+
object({ task: text }),
|
|
199
|
+
object({ id: identifier, status: { const: 'pending' } })
|
|
200
|
+
),
|
|
201
|
+
descriptor(
|
|
202
|
+
'get_task_status',
|
|
203
|
+
'coordination',
|
|
204
|
+
'Read the status of a declared simulated task.',
|
|
205
|
+
'coordination',
|
|
206
|
+
'read',
|
|
207
|
+
object({ id: identifier }),
|
|
208
|
+
object({ id: identifier, status: { enum: ['pending', 'completed', 'failed'] } })
|
|
209
|
+
),
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
/** Defensive copies prevent callers or adapters from modifying the catalog's authority. */
|
|
213
|
+
export function listWorkflowTools(): WorkflowToolDescriptor[] {
|
|
214
|
+
return structuredClone(tools);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function getWorkflowTool(id: string): WorkflowToolDescriptor | undefined {
|
|
218
|
+
const tool = tools.find((candidate) => candidate.id === id);
|
|
219
|
+
return tool ? structuredClone(tool) : undefined;
|
|
220
|
+
}
|