@skastr0/prism-linux-x64 0.5.1 → 0.8.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.
Files changed (48) hide show
  1. package/bin/prism +2 -2
  2. package/package.json +3 -3
  3. package/types/amp-projects.d.ts +39 -0
  4. package/types/amp-runners.d.ts +71 -0
  5. package/types/ast-to-json-schema.d.ts +46 -0
  6. package/types/compile/errors.d.ts +57 -79
  7. package/types/compile/runtime/schema-bridge.d.ts +15 -12
  8. package/types/errors.d.ts +24 -34
  9. package/types/fs.d.ts +2 -2
  10. package/types/harness-types-discover.d.ts +34 -0
  11. package/types/harness-types.d.ts +12 -0
  12. package/types/index.d.ts +21 -2
  13. package/types/jev.d.ts +254 -0
  14. package/types/lowerer-capabilities.d.ts +104 -118
  15. package/types/prism-home.d.ts +3 -4
  16. package/types/services/jev.d.ts +131 -0
  17. package/types/types.d.ts +3 -13
  18. package/types/workflow-amp-remote-worker.d.ts +69 -0
  19. package/types/workflow-amp-worker.d.ts +89 -0
  20. package/types/workflow-antigravity-pty.d.ts +22 -0
  21. package/types/workflow-antigravity-worker.d.ts +84 -0
  22. package/types/workflow-bun-runtime.d.ts +2 -0
  23. package/types/workflow-claude-worker.d.ts +36 -0
  24. package/types/workflow-cli-command.d.ts +1 -0
  25. package/types/workflow-codex-worker.d.ts +36 -0
  26. package/types/workflow-cursor-worker.d.ts +24 -0
  27. package/types/workflow-devin-worker.d.ts +25 -0
  28. package/types/workflow-effort.d.ts +18 -0
  29. package/types/workflow-grok-worker.d.ts +32 -0
  30. package/types/workflow-harness-detection.d.ts +5 -8
  31. package/types/workflow-hermes-worker.d.ts +28 -0
  32. package/types/workflow-identity.d.ts +35 -6
  33. package/types/workflow-kimi-effort.d.ts +17 -0
  34. package/types/workflow-kimi-worker.d.ts +27 -0
  35. package/types/workflow-omp-worker.d.ts +49 -0
  36. package/types/workflow-opencode-worker.d.ts +26 -0
  37. package/types/workflow-output-schema.d.ts +6 -0
  38. package/types/workflow-permissions.d.ts +10 -0
  39. package/types/workflow-process-guard.d.ts +28 -0
  40. package/types/workflow-runner.d.ts +15 -1
  41. package/types/workflow-scheduler/cron.d.ts +60 -0
  42. package/types/workflow-scheduler/errors.d.ts +71 -0
  43. package/types/workflow-scheduler/schedule.d.ts +61 -0
  44. package/types/workflow-session.d.ts +46 -29
  45. package/types/workflow-store.d.ts +142 -7
  46. package/types/workflow-worker-process.d.ts +40 -0
  47. package/types/workflow-workers.d.ts +50 -0
  48. package/types/workflows.d.ts +204 -23
package/bin/prism CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/prism
3
- size: 128325760 bytes
4
- sha256: 5f5152c8f1bce96f150449ead8e4b466138ad4a6d56c411b3829a841451bdd16
3
+ size: 115074528 bytes
4
+ sha256: 00dc6342ae9e2c0fb5d1d11346f145a35c572b36a5e0dc98800e1a0576f82b69
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skastr0/prism-linux-x64",
3
- "version": "0.5.1",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "Prism standalone CLI binary for Linux x64.",
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@opencode-ai/plugin": "^1.15.13",
21
- "@skastr0/prism-sdk": "0.5.1",
22
- "effect": "^3.21.1",
21
+ "@skastr0/prism-sdk": "0.8.0",
22
+ "effect": "4.0.0-rc.115",
23
23
  "typescript": "^5.8.3",
24
24
  "zod": "4.4.3"
25
25
  },
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Amp orb projects, discovered by `prism workflow refresh-harness-types` from
3
+ * `amp projects list --json` and used to type and validate `worker.project`
4
+ * on `amp-orb` tasks and named workers.
5
+ *
6
+ * `amp --project` documents three identifier forms (namespace/name,
7
+ * owner/repo, repository URL); each project contributes every form it has.
8
+ * Project ids and `@namespace/name` also resolve through `amp projects get`,
9
+ * but `--project` does not document them, so they are not admitted.
10
+ */
11
+ export interface AmpProject {
12
+ readonly id: string;
13
+ readonly namespace: string;
14
+ readonly name: string;
15
+ readonly repositoryURL?: string;
16
+ readonly remoteURLs?: readonly string[];
17
+ }
18
+ export interface DiscoveredAmpProjects {
19
+ readonly projects: readonly AmpProject[];
20
+ readonly source: "command" | "empty";
21
+ readonly error?: string;
22
+ }
23
+ /** Parse `amp projects list --json`: an array of `{ id, namespace, name, repositoryURL, remoteURLs }`. */
24
+ export declare const parseAmpProjectsList: (stdout: string) => {
25
+ readonly projects: AmpProject[];
26
+ readonly error?: string;
27
+ };
28
+ /** The canonical `--project` form. */
29
+ export declare const ampProjectCanonicalRef: (project: AmpProject) => string;
30
+ /** Every documented `--project` form for one project: namespace/name, owner/repo, and repository URLs. */
31
+ export declare const ampProjectRefs: (project: AmpProject) => readonly string[];
32
+ /** Sorted union of every admitted `worker.project` value. Empty when discovery found none. */
33
+ export declare const ampOrbProjectRefs: (discovered: DiscoveredAmpProjects | undefined) => readonly string[];
34
+ /**
35
+ * Fail closed on an `amp-orb` project that the snapshot does not list.
36
+ * No snapshot, or a snapshot without projects, leaves `project` a free string
37
+ * (the same fallback as every other discovered union).
38
+ */
39
+ export declare const validateAmpOrbProject: (project: string, discovered: DiscoveredAmpProjects | undefined) => string | undefined;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Amp runners, discovered on demand by
3
+ * `prism workflow refresh-harness-types --discover-amp-runners` and used to
4
+ * type and validate `worker.runnerId` / `worker.runnerDir` on `amp-runner`
5
+ * tasks and named workers.
6
+ *
7
+ * Amp exposes no account-wide runner CLI command or REST route; the surface is
8
+ * the `list_runners` platform tool inside an Amp thread (the same data the
9
+ * ampcode.com thread composer's location picker shows). Discovery therefore
10
+ * spends one small `amp -x --stream-json` turn and parses the list_runners
11
+ * TOOL RESULT from the transcript — never the assistant's echoed text, which
12
+ * can reformat or truncate the JSON.
13
+ *
14
+ * An old entry is valid: there are no staleness warnings, and Amp re-validates
15
+ * `--executor runner:<id>` against live runners at spawn time.
16
+ */
17
+ export declare const AMP_RUNNERS_REFRESH_COMMAND = "prism workflow refresh-harness-types --discover-amp-runners";
18
+ export interface AmpRunnerDirectory {
19
+ readonly path: string;
20
+ readonly repositoryURL?: string;
21
+ readonly canCreateWorktree?: boolean;
22
+ }
23
+ export interface AmpRunner {
24
+ readonly runnerId: string;
25
+ readonly name: string;
26
+ readonly hostname?: string;
27
+ readonly workingDirectory?: string;
28
+ readonly repositoryURL?: string;
29
+ /** The runner's own last-seen timestamp from Amp, as reported. */
30
+ readonly lastSeenAt: string;
31
+ readonly capabilities: readonly string[];
32
+ readonly directories: readonly AmpRunnerDirectory[];
33
+ }
34
+ export interface DiscoveredAmpRunners {
35
+ readonly runners: readonly AmpRunner[];
36
+ readonly source: "command" | "empty";
37
+ /** When the one-shot capture ran (distinct from each runner's lastSeenAt). */
38
+ readonly capturedAt?: string;
39
+ readonly error?: string;
40
+ }
41
+ /** `list_runners` prompt: call the tool, then print its raw JSON and nothing else. */
42
+ export declare const AMP_RUNNERS_PROMPT = "Call the list_runners tool with no arguments. Then output exactly the JSON object it returned, with text(JSON.stringify(result)), and nothing else. Do not summarize, reformat, or omit any fields.";
43
+ /**
44
+ * Sentinel the discovery runner emits when the amp turn itself failed, so the
45
+ * reason survives the fail-soft string-only command contract.
46
+ */
47
+ export declare const AMP_TURN_ERROR_PREFIX = "AMP_TURN_ERROR:";
48
+ /**
49
+ * Parse the `amp -x <prompt> --stream-json` transcript: the list_runners tool
50
+ * result only. Required fields fail closed through the Effect Schema decode;
51
+ * upstream extras are ignored. Returns the discovery thread id so the caller
52
+ * can delete it.
53
+ */
54
+ export declare const parseAmpRunnersStreamJson: (stdout: string) => {
55
+ readonly runners: AmpRunner[];
56
+ readonly sessionId?: string;
57
+ readonly error?: string;
58
+ };
59
+ /** Sorted runner ids in the snapshot. Empty when discovery found none. */
60
+ export declare const ampRunnerIds: (discovered: DiscoveredAmpRunners | undefined) => readonly string[];
61
+ /** Sorted unique directories one runner serves. */
62
+ export declare const ampRunnerServedDirs: (runner: AmpRunner) => readonly string[];
63
+ /** One runner's directories, normalized and deduped (the snapshot's canonical form). */
64
+ export declare const ampRunnerNormalizedDirs: (runner: AmpRunner) => readonly AmpRunnerDirectory[];
65
+ /**
66
+ * Fail closed on an `amp-runner` target the snapshot does not know: an unknown
67
+ * runnerId, or a runnerDir that runner does not serve. No snapshot, or one
68
+ * without runners, leaves both a free string (the same fallback as every other
69
+ * discovered union). `runnerDir` is optional: the runner's start directory.
70
+ */
71
+ export declare const validateAmpRunnerTarget: (runnerId: string, runnerDir: string | undefined, discovered: DiscoveredAmpRunners | undefined) => string | undefined;
@@ -0,0 +1,46 @@
1
+ import { Schema, SchemaAST } from "effect";
2
+ export type JsonSchema = Record<string, unknown>;
3
+ export type AstToJsonSchemaOptions = {
4
+ readonly errorPrefix?: string;
5
+ /** Kimi and some MCP clients reject JSON Schema `const`; `enum` is the safe default. */
6
+ readonly literalRepresentation?: "enum" | "const";
7
+ readonly unknownKeywordSchema?: JsonSchema;
8
+ /**
9
+ * When true, a node's checks (refinements) are ignored and an encoding
10
+ * (transformation) is followed to its encoded side, so the JSON Schema
11
+ * describes the wire shape. This is the MCP / Zod / OpenCode schema-bridge
12
+ * stance. Workflow output schemas keep the default (reject), because their
13
+ * decoded value must equal its JSON representation.
14
+ */
15
+ readonly allowChecksAndEncodings?: boolean;
16
+ /**
17
+ * When true, map Effect `Schema.Record` (index signatures on the object node)
18
+ * to JSON Schema `{ type: "object", additionalProperties: ... }`. Workflow
19
+ * output schemas keep the default (reject).
20
+ */
21
+ readonly allowIndexSignatures?: boolean;
22
+ /**
23
+ * When true, render general (non-literal) unions as `anyOf` member schemas —
24
+ * `oneOf` when the union AST declares that mode — instead of failing closed.
25
+ * Tool/MCP input surfaces enable this; workflow output schemas keep the
26
+ * default (reject) so worker output contracts stay strict.
27
+ */
28
+ readonly allowGeneralUnions?: boolean;
29
+ };
30
+ export declare class WorkflowOutputSchemaError extends Error {
31
+ readonly name = "WorkflowOutputSchemaError";
32
+ }
33
+ export declare const astToJsonSchema: (ast: SchemaAST.AST, options?: AstToJsonSchemaOptions, fieldPath?: string) => JsonSchema;
34
+ export declare const jsonSchemaFromEffectSchema: (schema: Schema.Top, options?: AstToJsonSchemaOptions) => JsonSchema;
35
+ export declare const WORKFLOW_AST_TO_JSON_SCHEMA_OPTIONS: {
36
+ readonly errorPrefix: "workflow output schema";
37
+ readonly literalRepresentation: "enum";
38
+ };
39
+ export declare const MCP_AST_TO_JSON_SCHEMA_OPTIONS: {
40
+ readonly errorPrefix: "mcp-schema-bridge";
41
+ readonly literalRepresentation: "enum";
42
+ readonly unknownKeywordSchema: {};
43
+ readonly allowChecksAndEncodings: true;
44
+ readonly allowIndexSignatures: true;
45
+ readonly allowGeneralUnions: true;
46
+ };
@@ -8,105 +8,83 @@
8
8
  */
9
9
  import { Schema } from "effect";
10
10
  import type { PluginManifestError } from "../errors.js";
11
- declare const SourceParseError_base: Schema.TaggedErrorClass<SourceParseError, "SourceParseError", {
12
- readonly _tag: Schema.tag<"SourceParseError">;
13
- } & {
14
- sourcePath: typeof Schema.String;
15
- kind: Schema.Literal<["identity", "personality", "agent", "modelspace", "skillspace", "sop", "tool", "hook"]>;
16
- message: typeof Schema.String;
17
- }>;
11
+ declare const SourceParseError_base: Schema.Class<SourceParseError, Schema.TaggedStruct<"SourceParseError", {
12
+ readonly sourcePath: Schema.String;
13
+ readonly kind: Schema.Literals<readonly ["identity", "personality", "agent", "modelspace", "skillspace", "sop", "tool", "hook"]>;
14
+ readonly message: Schema.String;
15
+ }>, import("effect/Cause").YieldableError>;
18
16
  export declare class SourceParseError extends SourceParseError_base {
19
17
  }
20
- declare const UnknownReferenceError_base: Schema.TaggedErrorClass<UnknownReferenceError, "UnknownReferenceError", {
21
- readonly _tag: Schema.tag<"UnknownReferenceError">;
22
- } & {
23
- agentName: typeof Schema.String;
24
- sourcePath: typeof Schema.String;
25
- field: Schema.Literal<["identity", "personality", "model", "skill", "phase.agent"]>;
26
- referenceName: typeof Schema.String;
27
- }>;
18
+ declare const UnknownReferenceError_base: Schema.Class<UnknownReferenceError, Schema.TaggedStruct<"UnknownReferenceError", {
19
+ readonly agentName: Schema.String;
20
+ readonly sourcePath: Schema.String;
21
+ readonly field: Schema.Literals<readonly ["identity", "personality", "model", "skill", "phase.agent"]>;
22
+ readonly referenceName: Schema.String;
23
+ }>, import("effect/Cause").YieldableError>;
28
24
  export declare class UnknownReferenceError extends UnknownReferenceError_base {
29
25
  }
30
- declare const UnknownDependencyError_base: Schema.TaggedErrorClass<UnknownDependencyError, "UnknownDependencyError", {
31
- readonly _tag: Schema.tag<"UnknownDependencyError">;
32
- } & {
33
- sourcePath: typeof Schema.String;
34
- referenceName: typeof Schema.String;
35
- depPrefix: typeof Schema.String;
36
- declaredDeps: Schema.Array$<typeof Schema.String>;
37
- }>;
26
+ declare const UnknownDependencyError_base: Schema.Class<UnknownDependencyError, Schema.TaggedStruct<"UnknownDependencyError", {
27
+ readonly sourcePath: Schema.String;
28
+ readonly referenceName: Schema.String;
29
+ readonly depPrefix: Schema.String;
30
+ readonly declaredDeps: Schema.$Array<Schema.String>;
31
+ }>, import("effect/Cause").YieldableError>;
38
32
  export declare class UnknownDependencyError extends UnknownDependencyError_base {
39
33
  }
40
- declare const DependencyCycleError_base: Schema.TaggedErrorClass<DependencyCycleError, "DependencyCycleError", {
41
- readonly _tag: Schema.tag<"DependencyCycleError">;
42
- } & {
43
- cycle: Schema.Array$<typeof Schema.String>;
44
- }>;
34
+ declare const DependencyCycleError_base: Schema.Class<DependencyCycleError, Schema.TaggedStruct<"DependencyCycleError", {
35
+ readonly cycle: Schema.$Array<Schema.String>;
36
+ }>, import("effect/Cause").YieldableError>;
45
37
  export declare class DependencyCycleError extends DependencyCycleError_base {
46
38
  }
47
- declare const UnknownTargetError_base: Schema.TaggedErrorClass<UnknownTargetError, "UnknownTargetError", {
48
- readonly _tag: Schema.tag<"UnknownTargetError">;
49
- } & {
50
- target: typeof Schema.String;
51
- supportedTargets: Schema.Array$<typeof Schema.String>;
52
- }>;
39
+ declare const UnknownTargetError_base: Schema.Class<UnknownTargetError, Schema.TaggedStruct<"UnknownTargetError", {
40
+ readonly target: Schema.String;
41
+ readonly supportedTargets: Schema.$Array<Schema.String>;
42
+ }>, import("effect/Cause").YieldableError>;
53
43
  export declare class UnknownTargetError extends UnknownTargetError_base {
54
44
  }
55
- declare const InvalidTargetScopeError_base: Schema.TaggedErrorClass<InvalidTargetScopeError, "InvalidTargetScopeError", {
56
- readonly _tag: Schema.tag<"InvalidTargetScopeError">;
57
- } & {
58
- target: typeof Schema.String;
59
- scope: typeof Schema.String;
60
- message: typeof Schema.String;
61
- }>;
45
+ declare const InvalidTargetScopeError_base: Schema.Class<InvalidTargetScopeError, Schema.TaggedStruct<"InvalidTargetScopeError", {
46
+ readonly target: Schema.String;
47
+ readonly scope: Schema.String;
48
+ readonly message: Schema.String;
49
+ }>, import("effect/Cause").YieldableError>;
62
50
  export declare class InvalidTargetScopeError extends InvalidTargetScopeError_base {
63
51
  }
64
- declare const UnsupportedTargetCapabilityError_base: Schema.TaggedErrorClass<UnsupportedTargetCapabilityError, "UnsupportedTargetCapabilityError", {
65
- readonly _tag: Schema.tag<"UnsupportedTargetCapabilityError">;
66
- } & {
67
- target: typeof Schema.String;
68
- capability: Schema.Literal<["compiled-agents", "hooks"]>;
69
- message: typeof Schema.String;
70
- }>;
52
+ declare const UnsupportedTargetCapabilityError_base: Schema.Class<UnsupportedTargetCapabilityError, Schema.TaggedStruct<"UnsupportedTargetCapabilityError", {
53
+ readonly target: Schema.String;
54
+ readonly capability: Schema.Literals<readonly ["compiled-agents", "hooks"]>;
55
+ readonly message: Schema.String;
56
+ }>, import("effect/Cause").YieldableError>;
71
57
  export declare class UnsupportedTargetCapabilityError extends UnsupportedTargetCapabilityError_base {
72
58
  }
73
- declare const AgentValidationError_base: Schema.TaggedErrorClass<AgentValidationError, "AgentValidationError", {
74
- readonly _tag: Schema.tag<"AgentValidationError">;
75
- } & {
76
- sourcePath: typeof Schema.String;
77
- agentName: typeof Schema.String;
78
- field: typeof Schema.String;
79
- message: typeof Schema.String;
80
- }>;
59
+ declare const AgentValidationError_base: Schema.Class<AgentValidationError, Schema.TaggedStruct<"AgentValidationError", {
60
+ readonly sourcePath: Schema.String;
61
+ readonly agentName: Schema.String;
62
+ readonly field: Schema.String;
63
+ readonly message: Schema.String;
64
+ }>, import("effect/Cause").YieldableError>;
81
65
  export declare class AgentValidationError extends AgentValidationError_base {
82
66
  }
83
- declare const DuplicateNameError_base: Schema.TaggedErrorClass<DuplicateNameError, "DuplicateNameError", {
84
- readonly _tag: Schema.tag<"DuplicateNameError">;
85
- } & {
86
- kind: Schema.Literal<["identity", "personality", "agent", "modelspace", "skillspace", "sop", "tool", "hook"]>;
87
- name: typeof Schema.String;
88
- firstPath: typeof Schema.String;
89
- secondPath: typeof Schema.String;
90
- }>;
67
+ declare const DuplicateNameError_base: Schema.Class<DuplicateNameError, Schema.TaggedStruct<"DuplicateNameError", {
68
+ readonly kind: Schema.Literals<readonly ["identity", "personality", "agent", "modelspace", "skillspace", "sop", "tool", "hook"]>;
69
+ readonly name: Schema.String;
70
+ readonly firstPath: Schema.String;
71
+ readonly secondPath: Schema.String;
72
+ }>, import("effect/Cause").YieldableError>;
91
73
  export declare class DuplicateNameError extends DuplicateNameError_base {
92
74
  }
93
- declare const AgentNameMismatchError_base: Schema.TaggedErrorClass<AgentNameMismatchError, "AgentNameMismatchError", {
94
- readonly _tag: Schema.tag<"AgentNameMismatchError">;
95
- } & {
96
- sourcePath: typeof Schema.String;
97
- fileStem: typeof Schema.String;
98
- agentName: typeof Schema.String;
99
- }>;
75
+ declare const AgentNameMismatchError_base: Schema.Class<AgentNameMismatchError, Schema.TaggedStruct<"AgentNameMismatchError", {
76
+ readonly sourcePath: Schema.String;
77
+ readonly fileStem: Schema.String;
78
+ readonly agentName: Schema.String;
79
+ }>, import("effect/Cause").YieldableError>;
100
80
  export declare class AgentNameMismatchError extends AgentNameMismatchError_base {
101
81
  }
102
- declare const MissingTargetResolutionError_base: Schema.TaggedErrorClass<MissingTargetResolutionError, "MissingTargetResolutionError", {
103
- readonly _tag: Schema.tag<"MissingTargetResolutionError">;
104
- } & {
105
- agentName: typeof Schema.String;
106
- referenceKind: Schema.Literal<["model-profile", "skill"]>;
107
- referenceName: typeof Schema.String;
108
- target: typeof Schema.String;
109
- }>;
82
+ declare const MissingTargetResolutionError_base: Schema.Class<MissingTargetResolutionError, Schema.TaggedStruct<"MissingTargetResolutionError", {
83
+ readonly agentName: Schema.String;
84
+ readonly referenceKind: Schema.Literals<readonly ["model-profile", "skill"]>;
85
+ readonly referenceName: Schema.String;
86
+ readonly target: Schema.String;
87
+ }>, import("effect/Cause").YieldableError>;
110
88
  export declare class MissingTargetResolutionError extends MissingTargetResolutionError_base {
111
89
  }
112
90
  export type CompileError = SourceParseError | UnknownReferenceError | AgentValidationError | UnknownTargetError | InvalidTargetScopeError | UnsupportedTargetCapabilityError | DuplicateNameError | AgentNameMismatchError | MissingTargetResolutionError | UnknownDependencyError | DependencyCycleError | PluginManifestError;
@@ -5,16 +5,18 @@
5
5
  *
6
6
  * Supports the bounded schema feature set used in contracts:
7
7
  *
8
- * - StringKeyword, NumberKeyword, BooleanKeyword, UnknownKeyword
9
- * - Literal (single) and Union of Literals (enum)
10
- * - TupleType with rest (arrays)
11
- * - TypeLiteral (nested structs)
12
- * - Refinement and Transformation (unwrapped; brands preserved via description)
13
- * - optional fields
8
+ * - String, Number, Boolean, Null
9
+ * - Unknown, Any (rendered honestly as z.unknown(): any JSON value)
10
+ * - Literal (single), Union of Literals (enum), and general unions (z.union)
11
+ * - Arrays with a single rest element (arrays)
12
+ * - Objects (nested structs), including optional fields
13
+ * - Records (`Schema.Record`) including mixed struct+index objects (catchall)
14
+ * - checks (refinements) and encodings (transformations) are rendered as
15
+ * their wire shape
16
+ * - nominal brands add no runtime validation and are not emitted
14
17
  *
15
- * Annotations flow through: a field's Schema.annotations({ description }) is
16
- * emitted as .describe(...) on the tool schema node so the LLM sees the
17
- * contract's own documentation.
18
+ * A field's Schema.annotate({ description }) is emitted as .describe(...) on the
19
+ * tool schema node so the LLM sees the contract's own documentation.
18
20
  */
19
21
  import { tool } from "@opencode-ai/plugin";
20
22
  import { Schema } from "effect";
@@ -51,11 +53,12 @@ export interface ToolRuntimeContext {
51
53
  * Convert a top-level Schema.Struct to the args record opencode expects.
52
54
  * Throws at plugin load time if the top-level schema is not a struct.
53
55
  */
54
- export declare const toolArgsFromSchema: (schema: Schema.Schema.Any) => Record<string, ZodNode>;
56
+ export declare const toolArgsFromSchema: (schema: Schema.Top) => Record<string, ZodNode>;
55
57
  /**
56
58
  * Decode raw tool-call args against the contract's Input schema. Throws a
57
59
  * clear error if decoding fails; the error propagates back to the LLM as the
58
- * tool call's failure message.
60
+ * tool call's failure message. Strict on excess properties: a misspelled
61
+ * field is a typo to surface, not noise to strip.
59
62
  */
60
- export declare const decodeInput: <A, I, R>(schema: Schema.Schema<A, I, R>, raw: unknown) => A;
63
+ export declare const decodeInput: <S extends Schema.Codec<unknown, unknown, never, never>>(schema: S, raw: unknown) => S["Type"];
61
64
  export {};
package/types/errors.d.ts CHANGED
@@ -16,15 +16,13 @@
16
16
  */
17
17
  import { Schema } from "effect";
18
18
  import { type CompileError } from "./compile/errors.js";
19
- declare const PluginManifestError_base: Schema.TaggedErrorClass<PluginManifestError, "PluginManifestError", {
20
- readonly _tag: Schema.tag<"PluginManifestError">;
21
- } & {
22
- pluginPath: typeof Schema.String;
23
- manifestPath: typeof Schema.String;
24
- pluginLabel: typeof Schema.String;
25
- summary: typeof Schema.String;
26
- details: Schema.Array$<typeof Schema.String>;
27
- }>;
19
+ declare const PluginManifestError_base: Schema.Class<PluginManifestError, Schema.TaggedStruct<"PluginManifestError", {
20
+ readonly pluginPath: Schema.String;
21
+ readonly manifestPath: Schema.String;
22
+ readonly pluginLabel: Schema.String;
23
+ readonly summary: Schema.String;
24
+ readonly details: Schema.$Array<Schema.String>;
25
+ }>, import("effect/Cause").YieldableError>;
28
26
  export declare class PluginManifestError extends PluginManifestError_base {
29
27
  /**
30
28
  * Build a manifest error from just a plugin path + summary, deriving the
@@ -35,39 +33,31 @@ export declare class PluginManifestError extends PluginManifestError_base {
35
33
  }): PluginManifestError;
36
34
  get message(): string;
37
35
  }
38
- declare const PrismConfigError_base: Schema.TaggedErrorClass<PrismConfigError, "PrismConfigError", {
39
- readonly _tag: Schema.tag<"PrismConfigError">;
40
- } & {
41
- message: typeof Schema.String;
42
- }>;
36
+ declare const PrismConfigError_base: Schema.Class<PrismConfigError, Schema.TaggedStruct<"PrismConfigError", {
37
+ readonly message: Schema.String;
38
+ }>, import("effect/Cause").YieldableError>;
43
39
  export declare class PrismConfigError extends PrismConfigError_base {
44
40
  }
45
- declare const BundleBuildError_base: Schema.TaggedErrorClass<BundleBuildError, "BundleBuildError", {
46
- readonly _tag: Schema.tag<"BundleBuildError">;
47
- } & {
48
- bundleKind: typeof Schema.String;
49
- diagnostics: typeof Schema.String;
50
- }>;
41
+ declare const BundleBuildError_base: Schema.Class<BundleBuildError, Schema.TaggedStruct<"BundleBuildError", {
42
+ readonly bundleKind: Schema.String;
43
+ readonly diagnostics: Schema.String;
44
+ }>, import("effect/Cause").YieldableError>;
51
45
  export declare class BundleBuildError extends BundleBuildError_base {
52
46
  get message(): string;
53
47
  }
54
- declare const BlockedTargetError_base: Schema.TaggedErrorClass<BlockedTargetError, "BlockedTargetError", {
55
- readonly _tag: Schema.tag<"BlockedTargetError">;
56
- } & {
57
- targetPath: typeof Schema.String;
58
- plugin: typeof Schema.String;
59
- hint: typeof Schema.String;
60
- }>;
48
+ declare const BlockedTargetError_base: Schema.Class<BlockedTargetError, Schema.TaggedStruct<"BlockedTargetError", {
49
+ readonly targetPath: Schema.String;
50
+ readonly plugin: Schema.String;
51
+ readonly hint: Schema.String;
52
+ }>, import("effect/Cause").YieldableError>;
61
53
  export declare class BlockedTargetError extends BlockedTargetError_base {
62
54
  get message(): string;
63
55
  }
64
- declare const PathConflictError_base: Schema.TaggedErrorClass<PathConflictError, "PathConflictError", {
65
- readonly _tag: Schema.tag<"PathConflictError">;
66
- } & {
67
- targetPath: typeof Schema.String;
68
- firstPlugin: typeof Schema.String;
69
- secondPlugin: typeof Schema.String;
70
- }>;
56
+ declare const PathConflictError_base: Schema.Class<PathConflictError, Schema.TaggedStruct<"PathConflictError", {
57
+ readonly targetPath: Schema.String;
58
+ readonly firstPlugin: Schema.String;
59
+ readonly secondPlugin: Schema.String;
60
+ }>, import("effect/Cause").YieldableError>;
71
61
  export declare class PathConflictError extends PathConflictError_base {
72
62
  get message(): string;
73
63
  }
package/types/fs.d.ts CHANGED
@@ -22,9 +22,9 @@ export declare function readFile(path: string): Promise<string>;
22
22
  */
23
23
  export declare function readJson<T>(path: string): Promise<T>;
24
24
  /**
25
- * Write string content to file
25
+ * Write content to a file atomically, preserving exact bytes for binary assets.
26
26
  */
27
- export declare function writeFile(path: string, content: string, options?: {
27
+ export declare function writeFile(path: string, content: string | Uint8Array, options?: {
28
28
  readonly mode?: number;
29
29
  }): Promise<void>;
30
30
  export declare function chmodFile(path: string, mode: number): Promise<void>;
@@ -3,6 +3,8 @@
3
3
  * Cache reads and CLI lists never throw; empty means "leave this worker as string".
4
4
  */
5
5
  import { type DiscoveredHarnessModels, type HarnessModelOption, type RefreshHarnessTypesResult } from "./harness-types.js";
6
+ import { type DiscoveredAmpProjects } from "./amp-projects.js";
7
+ import { type DiscoveredAmpRunners } from "./amp-runners.js";
6
8
  export type HarnessTypesReadText = (path: string) => string | undefined;
7
9
  export type HarnessTypesCommandRunner = (command: string, args: readonly string[]) => Promise<string>;
8
10
  export interface DiscoverHarnessTypesOptions {
@@ -10,6 +12,14 @@ export interface DiscoverHarnessTypesOptions {
10
12
  readonly env?: Readonly<Record<string, string | undefined>>;
11
13
  readonly readText?: HarnessTypesReadText;
12
14
  readonly runCommand?: HarnessTypesCommandRunner;
15
+ /**
16
+ * Also snapshot the account-wide Amp runners with a one-shot `amp -x` turn
17
+ * whose only job is calling the `list_runners` platform tool. Opt-in: the
18
+ * turn creates a small Amp thread (cheapest mode, deleted afterwards).
19
+ * A plain refresh never runs it and preserves a previously captured
20
+ * runner snapshot.
21
+ */
22
+ readonly discoverAmpRunners?: boolean;
13
23
  }
14
24
  export declare const parseClaudeModelCache: (raw: string) => {
15
25
  readonly models: HarnessModelOption[];
@@ -61,5 +71,29 @@ export declare const parseAmpAgentOptions: (raw: string) => {
61
71
  readonly error?: string;
62
72
  };
63
73
  export declare const discoverWorkflowHarnessModels: (options?: DiscoverHarnessTypesOptions) => Promise<readonly DiscoveredHarnessModels[]>;
74
+ /** Amp orb projects from `amp projects list --json`. Fail-soft like model discovery. */
75
+ export declare const discoverAmpProjects: (options?: DiscoverHarnessTypesOptions) => Promise<DiscoveredAmpProjects>;
76
+ /**
77
+ * Runner discovery turns can take a couple of minutes (an agent turn, not a
78
+ * CLI list), so they get their own runner with a longer timeout than the
79
+ * 8s `defaultRunCommand`. On failure the reason is surfaced through the
80
+ * `AMP_TURN_ERROR:` sentinel; the untruncated partial stdout is appended on
81
+ * its own line so the init line's session id survives for thread cleanup.
82
+ */
83
+ export declare const defaultAmpTurnRunner: HarnessTypesCommandRunner;
84
+ /**
85
+ * Snapshot the account-wide Amp runners: one `amp -x --stream-json` turn in
86
+ * the cheapest mode whose only job is calling `list_runners`, parsed from the
87
+ * tool result. Fail-soft: a failed capture records the reason and no runners,
88
+ * but still deletes any thread the turn created (its partial stdout carries
89
+ * the session id even when the turn times out). The reason is also returned
90
+ * so the caller can surface it when the capture was explicitly requested.
91
+ */
92
+ export declare const discoverAmpRunners: (options?: DiscoverHarnessTypesOptions) => Promise<{
93
+ readonly discovered: DiscoveredAmpRunners;
94
+ readonly failedExplicit?: string;
95
+ }>;
96
+ /** Previously captured runner snapshot, preserved by a plain refresh. */
97
+ export declare const previousAmpRunners: (prismHome: string) => DiscoveredAmpRunners | undefined;
64
98
  export declare const refreshHarnessTypes: (prismHome: string, options?: DiscoverHarnessTypesOptions) => Promise<RefreshHarnessTypesResult>;
65
99
  export declare const renderHarnessTypesRefreshHuman: (result: RefreshHarnessTypesResult) => string;
@@ -5,6 +5,8 @@
5
5
  * `<PRISM_HOME>/state/harness-types/`. Not project-keyed — harnesses are
6
6
  * installed on the machine, not per repo.
7
7
  */
8
+ import { type DiscoveredAmpProjects } from "./amp-projects.js";
9
+ import { type DiscoveredAmpRunners } from "./amp-runners.js";
8
10
  import type { WorkflowWorkerId } from "./workflows.js";
9
11
  export declare const HARNESS_TYPES_DIRNAME = "harness-types";
10
12
  export declare const HARNESS_MODELS_FILENAME = "harness-models.ts";
@@ -31,11 +33,21 @@ export interface DiscoveredHarnessModels {
31
33
  export interface HarnessTypesSnapshot {
32
34
  readonly generatedAt: string;
33
35
  readonly harnesses: readonly DiscoveredHarnessModels[];
36
+ /** `amp projects list --json`: types and validates `amp-orb` `worker.project`. */
37
+ readonly ampProjects?: DiscoveredAmpProjects;
38
+ /** `list_runners` (one-shot Amp turn): types and validates `amp-runner` `worker.runnerId`/`runnerDir`. */
39
+ readonly ampRunners?: DiscoveredAmpRunners;
34
40
  }
35
41
  export interface RefreshHarnessTypesResult {
36
42
  readonly modelsPath: string;
37
43
  readonly discoveredPath: string;
38
44
  readonly snapshot: HarnessTypesSnapshot;
45
+ /**
46
+ * Set only when the explicit `--discover-amp-runners` capture failed: the
47
+ * reason plus what was kept. The refresh itself still succeeded; the CLI
48
+ * surfaces this as a non-zero exit so the failure is never silent.
49
+ */
50
+ readonly ampRunnersCaptureError?: string;
39
51
  }
40
52
  /**
41
53
  * Render the generated `prism/harnesses` module. A worker appears only
package/types/index.d.ts CHANGED
@@ -10,6 +10,7 @@
10
10
  *
11
11
  * These helpers are identity constructors for authoring ergonomics.
12
12
  */
13
+ export * from "./jev.js";
13
14
  export * from "./workflow-errors.js";
14
15
  export * from "./workflow-harness-detection.js";
15
16
  export * from "./workflows.js";
@@ -43,7 +44,7 @@ export interface SkillspaceRefDefinition {
43
44
  export type AgentRefInput = string | AgentRefDefinition;
44
45
  export type ModelProfileRefInput = string | ModelProfileRefDefinition;
45
46
  export type SkillRefInput = SkillRefDefinition | SkillspaceRefDefinition;
46
- export type EffectSchemaValue = import("effect").Schema.Schema.AnyNoContext;
47
+ export type EffectSchemaValue = import("effect").Schema.Top;
47
48
  export interface AgentDefinition {
48
49
  readonly name: string;
49
50
  readonly description: string;
@@ -98,6 +99,16 @@ export type SopSource = SopDefinition;
98
99
  export interface ModelTargetDefinition {
99
100
  readonly model: string;
100
101
  readonly variant?: string;
102
+ readonly effort?: string;
103
+ readonly provider?: string;
104
+ readonly temperature?: number;
105
+ readonly top_p?: number;
106
+ }
107
+ export interface ReasoningEffortModelTargetDefinition {
108
+ readonly model: string;
109
+ readonly effort?: string;
110
+ readonly variant?: never;
111
+ readonly provider?: string;
101
112
  readonly temperature?: number;
102
113
  readonly top_p?: number;
103
114
  }
@@ -106,9 +117,17 @@ export interface ModelPoolTargetDefinition {
106
117
  readonly models: readonly ModelTargetDefinition[];
107
118
  }
108
119
  export type ModelTargetBlockDefinition = ModelTargetDefinition | ModelPoolTargetDefinition | Readonly<Record<string, unknown>>;
120
+ export type ReasoningEffortModelTargetBlockDefinition = ReasoningEffortModelTargetDefinition | {
121
+ readonly strategy: "any-of" | "round-robin" | "ordered";
122
+ readonly models: readonly ReasoningEffortModelTargetDefinition[];
123
+ };
124
+ export type ModelProfileTargets = Readonly<Record<string, ModelTargetBlockDefinition>> & {
125
+ readonly "codex-cli"?: ReasoningEffortModelTargetBlockDefinition;
126
+ readonly omp?: ReasoningEffortModelTargetBlockDefinition;
127
+ };
109
128
  export interface ModelProfileDefinition {
110
129
  readonly description?: string;
111
- readonly targets: Readonly<Record<string, ModelTargetBlockDefinition>>;
130
+ readonly targets: ModelProfileTargets;
112
131
  }
113
132
  export interface ModelspaceDefinition {
114
133
  readonly name: string;