skillscript-runtime 0.2.4
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/ARCHITECTURE.md +70 -0
- package/LICENSE +21 -0
- package/README.md +346 -0
- package/dist/audit.d.ts +33 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +76 -0
- package/dist/audit.js.map +1 -0
- package/dist/bootstrap.d.ts +69 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +117 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +805 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile.d.ts +88 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +544 -0
- package/dist/compile.js.map +1 -0
- package/dist/connectors/agent-noop.d.ts +23 -0
- package/dist/connectors/agent-noop.d.ts.map +1 -0
- package/dist/connectors/agent-noop.js +43 -0
- package/dist/connectors/agent-noop.js.map +1 -0
- package/dist/connectors/agent.d.ts +54 -0
- package/dist/connectors/agent.d.ts.map +1 -0
- package/dist/connectors/agent.js +21 -0
- package/dist/connectors/agent.js.map +1 -0
- package/dist/connectors/index.d.ts +13 -0
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/index.js +17 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors/local-model.d.ts +41 -0
- package/dist/connectors/local-model.d.ts.map +1 -0
- package/dist/connectors/local-model.js +106 -0
- package/dist/connectors/local-model.js.map +1 -0
- package/dist/connectors/mcp.d.ts +22 -0
- package/dist/connectors/mcp.d.ts.map +1 -0
- package/dist/connectors/mcp.js +31 -0
- package/dist/connectors/mcp.js.map +1 -0
- package/dist/connectors/memory-store.d.ts +53 -0
- package/dist/connectors/memory-store.d.ts.map +1 -0
- package/dist/connectors/memory-store.js +169 -0
- package/dist/connectors/memory-store.js.map +1 -0
- package/dist/connectors/registry.d.ts +74 -0
- package/dist/connectors/registry.d.ts.map +1 -0
- package/dist/connectors/registry.js +127 -0
- package/dist/connectors/registry.js.map +1 -0
- package/dist/connectors/skill-store.d.ts +38 -0
- package/dist/connectors/skill-store.d.ts.map +1 -0
- package/dist/connectors/skill-store.js +314 -0
- package/dist/connectors/skill-store.js.map +1 -0
- package/dist/connectors/types.d.ts +188 -0
- package/dist/connectors/types.d.ts.map +1 -0
- package/dist/connectors/types.js +35 -0
- package/dist/connectors/types.js.map +1 -0
- package/dist/dashboard/server.d.ts +40 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.js +122 -0
- package/dist/dashboard/server.js.map +1 -0
- package/dist/dashboard/spa/app.js +375 -0
- package/dist/dashboard/spa/index.html +26 -0
- package/dist/dashboard/spa/styles.css +99 -0
- package/dist/errors.d.ts +111 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +187 -0
- package/dist/errors.js.map +1 -0
- package/dist/filters.d.ts +17 -0
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +40 -0
- package/dist/filters.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/lint.d.ts +97 -0
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +990 -0
- package/dist/lint.js.map +1 -0
- package/dist/mcp-server.d.ts +93 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +505 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/metrics.d.ts +51 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +107 -0
- package/dist/metrics.js.map +1 -0
- package/dist/parser.d.ts +160 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +991 -0
- package/dist/parser.js.map +1 -0
- package/dist/provenance.d.ts +43 -0
- package/dist/provenance.d.ts.map +1 -0
- package/dist/provenance.js +58 -0
- package/dist/provenance.js.map +1 -0
- package/dist/runtime.d.ts +145 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1071 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scheduler.d.ts +121 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +271 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/skill-manager.d.ts +121 -0
- package/dist/skill-manager.d.ts.map +1 -0
- package/dist/skill-manager.js +251 -0
- package/dist/skill-manager.js.map +1 -0
- package/dist/testing/conformance.d.ts +57 -0
- package/dist/testing/conformance.d.ts.map +1 -0
- package/dist/testing/conformance.js +365 -0
- package/dist/testing/conformance.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/trace.d.ts +141 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +226 -0
- package/dist/trace.js.map +1 -0
- package/examples/README.md +56 -0
- package/examples/classify-support-ticket.skill.md +30 -0
- package/examples/cut-release-tag.skill.md +40 -0
- package/examples/doc-qa-with-citations.skill.md +12 -0
- package/examples/feedback-sentiment-scan.skill.md +29 -0
- package/examples/hello.skill.md +9 -0
- package/examples/hello.skill.provenance.json +10 -0
- package/examples/morning-brief.skill.md +24 -0
- package/examples/programmatic-trace-demo.mjs +89 -0
- package/examples/service-health-watch.skill.md +18 -0
- package/package.json +100 -0
- package/scaffold/config.toml +35 -0
- package/scaffold/connectors.json +19 -0
- package/scaffold/examples/hello.skill.md +9 -0
package/dist/errors.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// Structured error hierarchy. Connectors throw these; the executor catches
|
|
2
|
+
// them and routes through the language's `else:` / `# OnError:` machinery.
|
|
3
|
+
// Filter helpers (`$(ERR|class)`) expose the error class to skill authors.
|
|
4
|
+
//
|
|
5
|
+
// Runtime-layer errors (e.g. `ReferentialIntegrityError`, Phase 2.1) are
|
|
6
|
+
// NOT subclasses of `ConnectorError` — they live at a different layer and
|
|
7
|
+
// don't pass through the executor's recovery machinery.
|
|
8
|
+
/**
|
|
9
|
+
* Base for any error thrown by a connector implementation. Carries the
|
|
10
|
+
* connector kind + implementation name so dispatch consumers can attribute
|
|
11
|
+
* failures precisely.
|
|
12
|
+
*/
|
|
13
|
+
export class ConnectorError extends Error {
|
|
14
|
+
connector_type;
|
|
15
|
+
implementation;
|
|
16
|
+
constructor(message, connector_type, implementation) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.connector_type = connector_type;
|
|
19
|
+
this.implementation = implementation;
|
|
20
|
+
this.name = "ConnectorError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class SkillNotFoundError extends ConnectorError {
|
|
24
|
+
skill_name;
|
|
25
|
+
constructor(skill_name, implementation) {
|
|
26
|
+
super(`Skill not found: '${skill_name}'`, "skill_store", implementation);
|
|
27
|
+
this.skill_name = skill_name;
|
|
28
|
+
this.name = "SkillNotFoundError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class VersionNotFoundError extends ConnectorError {
|
|
32
|
+
skill_name;
|
|
33
|
+
version;
|
|
34
|
+
constructor(skill_name, version, implementation) {
|
|
35
|
+
super(`Version '${version}' of skill '${skill_name}' not found`, "skill_store", implementation);
|
|
36
|
+
this.skill_name = skill_name;
|
|
37
|
+
this.version = version;
|
|
38
|
+
this.name = "VersionNotFoundError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export class LintFailureError extends ConnectorError {
|
|
42
|
+
diagnostics;
|
|
43
|
+
constructor(diagnostics, implementation) {
|
|
44
|
+
const summary = diagnostics.map((d) => `[${d.rule}] ${d.message}`).join("; ");
|
|
45
|
+
super(`Tier-1 lint failure: ${summary}`, "skill_store", implementation);
|
|
46
|
+
this.diagnostics = diagnostics;
|
|
47
|
+
this.name = "LintFailureError";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export class StorageConflictError extends ConnectorError {
|
|
51
|
+
skill_name;
|
|
52
|
+
reason;
|
|
53
|
+
constructor(skill_name, reason, implementation) {
|
|
54
|
+
super(`Storage conflict on '${skill_name}': ${reason}`, "skill_store", implementation);
|
|
55
|
+
this.skill_name = skill_name;
|
|
56
|
+
this.reason = reason;
|
|
57
|
+
this.name = "StorageConflictError";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export class QueryError extends ConnectorError {
|
|
61
|
+
mode;
|
|
62
|
+
constructor(message, connector_type, implementation, mode) {
|
|
63
|
+
super(message, connector_type, implementation);
|
|
64
|
+
this.mode = mode;
|
|
65
|
+
this.name = "QueryError";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export class DispatchError extends ConnectorError {
|
|
69
|
+
tool;
|
|
70
|
+
constructor(message, implementation, tool) {
|
|
71
|
+
super(message, "mcp_connector", implementation);
|
|
72
|
+
this.tool = tool;
|
|
73
|
+
this.name = "DispatchError";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export class ModelError extends ConnectorError {
|
|
77
|
+
model;
|
|
78
|
+
constructor(message, implementation, model) {
|
|
79
|
+
super(message, "local_model", implementation);
|
|
80
|
+
this.model = model;
|
|
81
|
+
this.name = "ModelError";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export class TimeoutError extends ConnectorError {
|
|
85
|
+
timeout_ms;
|
|
86
|
+
constructor(connector_type, implementation, timeout_ms) {
|
|
87
|
+
super(`Operation timed out after ${timeout_ms}ms`, connector_type, implementation);
|
|
88
|
+
this.timeout_ms = timeout_ms;
|
|
89
|
+
this.name = "TimeoutError";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// ─── Op-level error hierarchy (executor layer) ──────────────────────────────
|
|
93
|
+
//
|
|
94
|
+
// Distinct from `ConnectorError` (substrate layer). OpError + subclasses are
|
|
95
|
+
// thrown at runtime by the executor / dispatcher, caught by the `else:` /
|
|
96
|
+
// `# OnError:` machinery, and surfaced in `result.errors[]` with structured
|
|
97
|
+
// metadata + canned remediation strings per ERD §8 + lesson `a3ba4149`
|
|
98
|
+
// (agent-authored output).
|
|
99
|
+
/**
|
|
100
|
+
* Base class for any error thrown during op dispatch. Carries the op kind,
|
|
101
|
+
* the target where the op lived, an optional inner cause (preserved when
|
|
102
|
+
* an underlying connector / spawn / etc. error propagates upward), and an
|
|
103
|
+
* actionable remediation string per `a3ba4149`.
|
|
104
|
+
*/
|
|
105
|
+
export class OpError extends Error {
|
|
106
|
+
opKind;
|
|
107
|
+
remediation;
|
|
108
|
+
target;
|
|
109
|
+
innerCause;
|
|
110
|
+
constructor(message, opKind, remediation, target, innerCause) {
|
|
111
|
+
super(message);
|
|
112
|
+
this.opKind = opKind;
|
|
113
|
+
this.remediation = remediation;
|
|
114
|
+
this.target = target;
|
|
115
|
+
this.innerCause = innerCause;
|
|
116
|
+
this.name = "OpError";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** A `$` / `~` / `>` op references a connector name not registered with the runtime. */
|
|
120
|
+
export class ConnectorNotFoundError extends OpError {
|
|
121
|
+
connectorName;
|
|
122
|
+
connectorType;
|
|
123
|
+
constructor(connectorName, connectorType, opKind, target) {
|
|
124
|
+
const message = `${connectorType} '${connectorName}' not registered with the runtime.`;
|
|
125
|
+
const remediation = `Configure the connector via the registry (\`registry.register${connectorType.replace(/_./g, (m) => m[1].toUpperCase())}\` API), ` +
|
|
126
|
+
`or check the spelling against the registered connector names. ` +
|
|
127
|
+
`Bare \`${opKind} ...\` routes through the 'primary'/'default' connector; ` +
|
|
128
|
+
`\`${opKind} <name>.<tool>\` routes through the named instance.`;
|
|
129
|
+
super(message, opKind, remediation, target);
|
|
130
|
+
this.connectorName = connectorName;
|
|
131
|
+
this.connectorType = connectorType;
|
|
132
|
+
this.name = "ConnectorNotFoundError";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** An op exceeded its resolved timeout (per-op > skill > built-in). */
|
|
136
|
+
export class OpTimeoutError extends OpError {
|
|
137
|
+
timeoutMs;
|
|
138
|
+
constructor(timeoutMs, opKind, target) {
|
|
139
|
+
const message = `Op '${opKind}' timed out after ${timeoutMs}ms.`;
|
|
140
|
+
const remediation = `Increase the timeout: per-op via \`${opKind === "~" ? "timeoutSeconds=N kwarg" : "(no per-op kwarg; use skill header)"}\`, ` +
|
|
141
|
+
`skill-level via \`# Timeout: N\` header (seconds), or runtime fallback via \`ctx.absoluteTimeoutMs\`. ` +
|
|
142
|
+
`If the op should be fast, investigate why it's slow — model service down, network partition, etc.`;
|
|
143
|
+
super(message, opKind, remediation, target);
|
|
144
|
+
this.timeoutMs = timeoutMs;
|
|
145
|
+
this.name = "OpTimeoutError";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** A `??` ask-user op fired in autonomous mode (no `askUser` callback wired). */
|
|
149
|
+
export class InteractiveOpInAutonomousModeError extends OpError {
|
|
150
|
+
prompt;
|
|
151
|
+
constructor(prompt, target) {
|
|
152
|
+
const message = `\`??\` ask-user encountered in autonomous execution: ${prompt}`;
|
|
153
|
+
const remediation = `Restructure the skill to take the value as an input (\`# Vars:\`) or via \`# Requires:\` cascade, ` +
|
|
154
|
+
`or invoke from an interactive context that wires the \`askUser\` callback on ExecuteContext.`;
|
|
155
|
+
super(message, "??", remediation, target);
|
|
156
|
+
this.prompt = prompt;
|
|
157
|
+
this.name = "InteractiveOpInAutonomousModeError";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** An `@ unsafe` op fired with `runtime.enable_unsafe_shell = false` (default). */
|
|
161
|
+
export class UnsafeShellDisabledError extends OpError {
|
|
162
|
+
command;
|
|
163
|
+
constructor(command, target) {
|
|
164
|
+
const truncated = command.length > 80 ? `${command.slice(0, 80)}...` : command;
|
|
165
|
+
const message = `\`@ unsafe\` op refused: \`runtime.enable_unsafe_shell\` is false. Command: '${truncated}'`;
|
|
166
|
+
const remediation = `Set \`ctx.enableUnsafeShell = true\` to permit (after reviewing the shell content), ` +
|
|
167
|
+
`or refactor to use the default \`@\` form with structured-spawn sandbox (one binary, no metacharacters). ` +
|
|
168
|
+
`\`@ unsafe\` is lint-flagged tier-2 every time it appears — confirm the shell content was reviewed.`;
|
|
169
|
+
super(message, "@", remediation, target);
|
|
170
|
+
this.command = command;
|
|
171
|
+
this.name = "UnsafeShellDisabledError";
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/** A `$(VAR)` reference couldn't be resolved at runtime. */
|
|
175
|
+
export class UnresolvedVariableError extends OpError {
|
|
176
|
+
varRef;
|
|
177
|
+
constructor(varRef, opKind, target) {
|
|
178
|
+
const message = `Unresolved variable reference at runtime: $(${varRef})`;
|
|
179
|
+
const remediation = `Declare the variable via \`# Vars:\`, \`# Requires:\`, or bind it from a prior op (\`-> ${varRef}\`). ` +
|
|
180
|
+
`Tier-1 ambient refs (NOW/USER/SESSION_CONTEXT/TRIGGER_TYPE/TRIGGER_PAYLOAD/ERROR_CONTEXT) ` +
|
|
181
|
+
`are auto-injected — check spelling. Dotted refs (\`$(X.field)\`) require the root \`X\` to be bound first.`;
|
|
182
|
+
super(message, opKind, remediation, target);
|
|
183
|
+
this.varRef = varRef;
|
|
184
|
+
this.name = "UnresolvedVariableError";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,wDAAwD;AAgBxD;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAGrB;IACA;IAHlB,YACE,OAAe,EACC,cAA6B,EAC7B,cAAsB;QAEtC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,mBAAc,GAAd,cAAc,CAAe;QAC7B,mBAAc,GAAd,cAAc,CAAQ;QAGtC,IAAI,CAAC,IA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QACzE,MAAM,WAAW,GACf,2FAA2F,MAAM,OAAO;YACxG,4FAA4F;YAC5F,4GAA4G,CAAC;QAC/G,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAT5B,WAAM,GAAN,MAAM,CAAQ;QAU9B,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The names of every registered filter. Lint's `unknown-filter` rule consults this. */
|
|
2
|
+
export declare const KNOWN_FILTERS: readonly ["url", "shell", "json", "trim"];
|
|
3
|
+
export type KnownFilter = (typeof KNOWN_FILTERS)[number];
|
|
4
|
+
/**
|
|
5
|
+
* Apply a named pipe filter to a string value. Filters supported in v1:
|
|
6
|
+
*
|
|
7
|
+
* url — `encodeURIComponent`. For URL path or query embedding.
|
|
8
|
+
* shell — POSIX single-quote shell-escape. Wraps in outer quotes; don't add your own.
|
|
9
|
+
* json — `JSON.stringify`. Produces a quoted JSON string literal.
|
|
10
|
+
* trim — strip leading/trailing whitespace. Useful on local-model outputs that
|
|
11
|
+
* often append a trailing newline that breaks `==` equality checks.
|
|
12
|
+
*
|
|
13
|
+
* Unknown filter names throw — typos are caught at compile time when the value
|
|
14
|
+
* is already resolved, or at runtime for ambient refs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyFilter(value: string, filter: string): string;
|
|
17
|
+
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,eAAO,MAAM,aAAa,2CAA4C,CAAC;AACvE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAYzD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAajE"}
|
package/dist/filters.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Pipe-filter implementations. `$(NAME|filter)` syntax dispatches here.
|
|
2
|
+
/** The names of every registered filter. Lint's `unknown-filter` rule consults this. */
|
|
3
|
+
export const KNOWN_FILTERS = ["url", "shell", "json", "trim"];
|
|
4
|
+
//
|
|
5
|
+
// Adding a new filter:
|
|
6
|
+
// 1. Add a case in `applyFilter` below.
|
|
7
|
+
// 2. Document it in `docs/LANGUAGE_REFERENCE.md` under the pipe-filter section.
|
|
8
|
+
// 3. Lint rule `unknown-filter` already covers compile-time validation —
|
|
9
|
+
// unknown filter names on resolved values throw, so authors discover typos
|
|
10
|
+
// at compile time without runtime surprise.
|
|
11
|
+
//
|
|
12
|
+
// All filters operate on strings. The caller (parser at compile time, runtime
|
|
13
|
+
// substituter at execution time) stringifies the underlying value first.
|
|
14
|
+
/**
|
|
15
|
+
* Apply a named pipe filter to a string value. Filters supported in v1:
|
|
16
|
+
*
|
|
17
|
+
* url — `encodeURIComponent`. For URL path or query embedding.
|
|
18
|
+
* shell — POSIX single-quote shell-escape. Wraps in outer quotes; don't add your own.
|
|
19
|
+
* json — `JSON.stringify`. Produces a quoted JSON string literal.
|
|
20
|
+
* trim — strip leading/trailing whitespace. Useful on local-model outputs that
|
|
21
|
+
* often append a trailing newline that breaks `==` equality checks.
|
|
22
|
+
*
|
|
23
|
+
* Unknown filter names throw — typos are caught at compile time when the value
|
|
24
|
+
* is already resolved, or at runtime for ambient refs.
|
|
25
|
+
*/
|
|
26
|
+
export function applyFilter(value, filter) {
|
|
27
|
+
switch (filter) {
|
|
28
|
+
case "url":
|
|
29
|
+
return encodeURIComponent(value);
|
|
30
|
+
case "shell":
|
|
31
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
32
|
+
case "json":
|
|
33
|
+
return JSON.stringify(value);
|
|
34
|
+
case "trim":
|
|
35
|
+
return value.trim();
|
|
36
|
+
default:
|
|
37
|
+
throw new Error(`Unknown filter '${filter}' — supported: url, shell, json, trim`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,wFAAwF;AACxF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAEvE,EAAE;AACF,uBAAuB;AACvB,0CAA0C;AAC1C,kFAAkF;AAClF,2EAA2E;AAC3E,gFAAgF;AAChF,iDAAiD;AACjD,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AAEzE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,MAAc;IACvD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,KAAK;YACR,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,OAAO;YACV,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;QAC7C,KAAK,MAAM;YACT,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,KAAK,MAAM;YACT,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACtB;YACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,uCAAuC,CAAC,CAAC;IACtF,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export { parse, tokenizeKeywordArgs, processSetValue } from "./parser.js";
|
|
2
|
+
export { toposort } from "./compile.js";
|
|
3
|
+
export { applyFilter } from "./filters.js";
|
|
4
|
+
export type { ParsedSkill, SkillOp, OpKind, SkillTarget, SkillType, SkillVar, SkillRequire, TriggerDecl, TriggerSource, OutputDecl, OutputKind, } from "./parser.js";
|
|
5
|
+
export { compile } from "./compile.js";
|
|
6
|
+
export type { CompileOptions, CompileResult, RenderFormat, RequireResolver, InlinedDataSkillRef } from "./compile.js";
|
|
7
|
+
export { buildProvenance, renderInlineProvenance, renderSidecarProvenance, PROVENANCE_VERSION, LANGUAGE_VERSION, COMPILER_VERSION, } from "./provenance.js";
|
|
8
|
+
export type { ProvenanceBlock, SourceSkillRef, BuildProvenanceInput } from "./provenance.js";
|
|
9
|
+
export { lint } from "./lint.js";
|
|
10
|
+
export type { LintFinding, LintResult, LintSeverity } from "./lint.js";
|
|
11
|
+
export { execute, substituteRuntime, resolveRef, stringifyValue, evalCondition, } from "./runtime.js";
|
|
12
|
+
export type { ExecuteContext, ExecuteResult, ExecutionError } from "./runtime.js";
|
|
13
|
+
export { Registry } from "./connectors/registry.js";
|
|
14
|
+
export { FilesystemSkillStore } from "./connectors/skill-store.js";
|
|
15
|
+
export { OllamaLocalModel } from "./connectors/local-model.js";
|
|
16
|
+
export type { OllamaConfig } from "./connectors/local-model.js";
|
|
17
|
+
export { SqliteMemoryStore } from "./connectors/memory-store.js";
|
|
18
|
+
export type { SqliteMemoryStoreConfig } from "./connectors/memory-store.js";
|
|
19
|
+
export { CallbackMcpConnector } from "./connectors/mcp.js";
|
|
20
|
+
export type { DispatchFn } from "./connectors/mcp.js";
|
|
21
|
+
export { NoOpAgentConnector } from "./connectors/agent-noop.js";
|
|
22
|
+
export type { AgentConnector, AgentConnectorClass, AgentDescriptor, AgentStatus, DeliveryPayload, DeliveryReceipt, WakeOpts, WakeReceipt, } from "./connectors/agent.js";
|
|
23
|
+
export type { SkillStore, SkillStoreClass, SkillSource, SkillMeta, SkillStatus, SkillFilter, VersionInfo, MemoryStore, MemoryStoreClass, PortableMemory, QueryFilters, LocalModel, LocalModelClass, McpConnector, McpConnectorClass, McpDispatchCtx, StaticCapabilities, ManifestInfo, ConnectorType, CuratedMemoryField, } from "./connectors/types.js";
|
|
24
|
+
export { CURATED_MEMORY_FIELDS } from "./connectors/types.js";
|
|
25
|
+
export { ConnectorError, SkillNotFoundError, VersionNotFoundError, LintFailureError, StorageConflictError, QueryError, DispatchError, ModelError, TimeoutError, OpError, ConnectorNotFoundError, OpTimeoutError, InteractiveOpInAutonomousModeError, UnsafeShellDisabledError, UnresolvedVariableError, } from "./errors.js";
|
|
26
|
+
export type { LintDiagnostic, OpErrorMetadata } from "./errors.js";
|
|
27
|
+
export { ReferenceIndex, ReferentialIntegrityError, buildReferenceIndex, extractReferences, storeSkill, deleteSkill, invalidateConnector, } from "./skill-manager.js";
|
|
28
|
+
export type { DeleteSkillOptions } from "./skill-manager.js";
|
|
29
|
+
export { audit, formatAuditResult } from "./audit.js";
|
|
30
|
+
export type { AuditResult, AuditFinding, AuditRule } from "./audit.js";
|
|
31
|
+
export { Scheduler, cronMatches } from "./scheduler.js";
|
|
32
|
+
export type { SchedulerConfig, TriggerRegistration, ResolvableTriggerSource } from "./scheduler.js";
|
|
33
|
+
export { FilesystemTraceStore, TraceBuilder, shouldSample, shouldTraceFire, TRACE_DEFAULTS, } from "./trace.js";
|
|
34
|
+
export type { TraceStore, TraceConfig, TraceMode, TraceRecord, TraceOpRecord, TraceQueryFilter, } from "./trace.js";
|
|
35
|
+
export { healthMetrics } from "./metrics.js";
|
|
36
|
+
export type { HealthMetrics, HealthMetricsFilter, PerSkillMetrics, PerConnectorMetrics, } from "./metrics.js";
|
|
37
|
+
export { McpServer } from "./mcp-server.js";
|
|
38
|
+
export type { McpServerDeps, McpTool, JsonRpcRequest, JsonRpcResponse, JsonRpcSuccessResponse, JsonRpcErrorResponse, } from "./mcp-server.js";
|
|
39
|
+
export { DashboardServer } from "./dashboard/server.js";
|
|
40
|
+
export type { DashboardServerConfig } from "./dashboard/server.js";
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE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AE,MAAM,YAAY,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEpG,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,aAAa,EACb,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EACV,aAAa,EACb,OAAO,EACP,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Library entrypoint. Embedders use named exports:
|
|
2
|
+
//
|
|
3
|
+
// import { compile, execute, lint, parse, Registry } from "skillscript-runtime";
|
|
4
|
+
// import { FilesystemSkillStore, OllamaLocalModel, SqliteMemoryStore, CallbackMcpConnector }
|
|
5
|
+
// from "skillscript-runtime";
|
|
6
|
+
//
|
|
7
|
+
// T1 ships parse + compile + lint + execute against the bundled-default
|
|
8
|
+
// connectors. Trigger registration, MCP server contract, richer compile-time
|
|
9
|
+
// semantics, and the full v1 lint set land in later threads (see
|
|
10
|
+
// ARCHITECTURE.md "Out-of-scope for T1").
|
|
11
|
+
export { parse, tokenizeKeywordArgs, processSetValue } from "./parser.js";
|
|
12
|
+
export { toposort } from "./compile.js";
|
|
13
|
+
export { applyFilter } from "./filters.js";
|
|
14
|
+
export { compile } from "./compile.js";
|
|
15
|
+
export { buildProvenance, renderInlineProvenance, renderSidecarProvenance, PROVENANCE_VERSION, LANGUAGE_VERSION, COMPILER_VERSION, } from "./provenance.js";
|
|
16
|
+
export { lint } from "./lint.js";
|
|
17
|
+
export { execute, substituteRuntime, resolveRef, stringifyValue, evalCondition, } from "./runtime.js";
|
|
18
|
+
export { Registry } from "./connectors/registry.js";
|
|
19
|
+
export { FilesystemSkillStore } from "./connectors/skill-store.js";
|
|
20
|
+
export { OllamaLocalModel } from "./connectors/local-model.js";
|
|
21
|
+
export { SqliteMemoryStore } from "./connectors/memory-store.js";
|
|
22
|
+
export { CallbackMcpConnector } from "./connectors/mcp.js";
|
|
23
|
+
export { NoOpAgentConnector } from "./connectors/agent-noop.js";
|
|
24
|
+
export { CURATED_MEMORY_FIELDS } from "./connectors/types.js";
|
|
25
|
+
export { ConnectorError, SkillNotFoundError, VersionNotFoundError, LintFailureError, StorageConflictError, QueryError, DispatchError, ModelError, TimeoutError, OpError, ConnectorNotFoundError, OpTimeoutError, InteractiveOpInAutonomousModeError, UnsafeShellDisabledError, UnresolvedVariableError, } from "./errors.js";
|
|
26
|
+
export { ReferenceIndex, ReferentialIntegrityError, buildReferenceIndex, extractReferences, storeSkill, deleteSkill, invalidateConnector, } from "./skill-manager.js";
|
|
27
|
+
export { audit, formatAuditResult } from "./audit.js";
|
|
28
|
+
export { Scheduler, cronMatches } from "./scheduler.js";
|
|
29
|
+
export { FilesystemTraceStore, TraceBuilder, shouldSample, shouldTraceFire, TRACE_DEFAULTS, } from "./trace.js";
|
|
30
|
+
export { healthMetrics } from "./metrics.js";
|
|
31
|
+
export { McpServer } from "./mcp-server.js";
|
|
32
|
+
export { DashboardServer } from "./dashboard/server.js";
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AAkC,EAClC,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;AAUpB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQ7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/lint.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { type ParsedSkill } from "./parser.js";
|
|
2
|
+
import type { StaticCapabilities, SkillStore } from "./connectors/types.js";
|
|
3
|
+
import type { Registry } from "./connectors/registry.js";
|
|
4
|
+
/**
|
|
5
|
+
* Lint engine. T4 ships 21 rules across three severity tiers:
|
|
6
|
+
*
|
|
7
|
+
* tier-1 (error) — hard-block at compile; rule output throws LintFailureError
|
|
8
|
+
* from `compile()` when present. Catches structural,
|
|
9
|
+
* grammar, and reference-integrity violations.
|
|
10
|
+
* tier-2 (warning) — requires human review before admission. Surfaces
|
|
11
|
+
* patterns that may be intentional but warrant
|
|
12
|
+
* double-check (`@@` shell, mutation without
|
|
13
|
+
* confirmation, model contention).
|
|
14
|
+
* tier-3 (info) — advisory style/quality nits. Authors can ignore.
|
|
15
|
+
*
|
|
16
|
+
* Diagnostics are agent-consumable JSON by default. The CLI's `--human`
|
|
17
|
+
* flag renders a terminal-friendly format over the same shape. The
|
|
18
|
+
* structured form carries `rule`, `severity`, `message`, optional `block`
|
|
19
|
+
* (target name), and rule-specific extras (e.g., `cycle: string[]` for
|
|
20
|
+
* `circular-dependency`).
|
|
21
|
+
*
|
|
22
|
+
* Rule registry pattern: every rule is an object `{ id, severity,
|
|
23
|
+
* description, check(parsed, ctx), remediation }`. The `lint()` function
|
|
24
|
+
* walks the registry. Adding a rule = adding an entry to `RULES`.
|
|
25
|
+
*
|
|
26
|
+
* Compile preflight: `compile()` calls `lint()` and throws
|
|
27
|
+
* `LintFailureError` if any tier-1 finding is present. Skills that
|
|
28
|
+
* fail tier-1 lint don't compile.
|
|
29
|
+
*/
|
|
30
|
+
export type LintSeverity = "error" | "warning" | "info";
|
|
31
|
+
export interface LintFinding {
|
|
32
|
+
rule: string;
|
|
33
|
+
severity: LintSeverity;
|
|
34
|
+
message: string;
|
|
35
|
+
/** Target name where the violation lives, when applicable. */
|
|
36
|
+
block?: string;
|
|
37
|
+
/** Canned remediation guidance per rule. */
|
|
38
|
+
remediation?: string;
|
|
39
|
+
/** Rule-specific structured extras. Agents parse this; humans see `message`. */
|
|
40
|
+
extras?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface LintResult {
|
|
43
|
+
findings: LintFinding[];
|
|
44
|
+
errorCount: number;
|
|
45
|
+
warningCount: number;
|
|
46
|
+
infoCount: number;
|
|
47
|
+
}
|
|
48
|
+
export interface LintOptions {
|
|
49
|
+
/**
|
|
50
|
+
* Connector classes whose `staticCapabilities()` provides the available
|
|
51
|
+
* feature flags. The linter calls these directly — no instance
|
|
52
|
+
* construction, no network, no substrate reachability required.
|
|
53
|
+
*/
|
|
54
|
+
classes?: Array<{
|
|
55
|
+
staticCapabilities(): StaticCapabilities;
|
|
56
|
+
}>;
|
|
57
|
+
/** Convenience: derive `classes` from a Registry's registered instances. */
|
|
58
|
+
registry?: Registry;
|
|
59
|
+
/**
|
|
60
|
+
* Optional SkillStore for reference-integrity rules (`unknown-skill-reference`,
|
|
61
|
+
* `disabled-skill-reference`). When absent, those rules don't fire — they
|
|
62
|
+
* can't validate without the store. The `missing-skillstore-for-data-ref`
|
|
63
|
+
* rule still fires (it checks for absence, not presence).
|
|
64
|
+
*/
|
|
65
|
+
skillStore?: SkillStore;
|
|
66
|
+
/**
|
|
67
|
+
* Where the lint was called from. Surfaces in diagnostics so operators
|
|
68
|
+
* can locate the fix (CLI invocation, library API caller, compile
|
|
69
|
+
* preflight). Default `"api"`.
|
|
70
|
+
*/
|
|
71
|
+
callSite?: "cli" | "api" | "compile-preflight";
|
|
72
|
+
}
|
|
73
|
+
interface LintContext {
|
|
74
|
+
parsed: ParsedSkill;
|
|
75
|
+
capabilityClasses: Array<{
|
|
76
|
+
staticCapabilities(): StaticCapabilities;
|
|
77
|
+
}> | null;
|
|
78
|
+
skillStore: SkillStore | undefined;
|
|
79
|
+
hasSkillStore: boolean;
|
|
80
|
+
callSite: "cli" | "api" | "compile-preflight";
|
|
81
|
+
}
|
|
82
|
+
export interface LintRule {
|
|
83
|
+
id: string;
|
|
84
|
+
severity: LintSeverity;
|
|
85
|
+
description: string;
|
|
86
|
+
check(ctx: LintContext): LintFinding[] | Promise<LintFinding[]>;
|
|
87
|
+
remediation: string;
|
|
88
|
+
}
|
|
89
|
+
export declare function lint(source: string, options?: LintOptions): Promise<LintResult>;
|
|
90
|
+
/** Synchronous variant for callers that don't need SkillStore-dependent rules. */
|
|
91
|
+
export declare function lintSync(source: string, options?: LintOptions): LintResult;
|
|
92
|
+
/** Human-readable formatter over the structured LintResult. JSON is the canonical form; this is for `--human` CLI output. */
|
|
93
|
+
export declare function formatLintResult(result: LintResult): string;
|
|
94
|
+
/** Read-only view of the rule registry — for tooling that introspects v1 rules. */
|
|
95
|
+
export declare function listRules(): ReadonlyArray<Omit<LintRule, "check">>;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"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