@getcliqio/cliq-sdk 0.0.0-stage → 1.15.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -2
- package/dist/agent_api.d.ts +39 -0
- package/dist/agent_api.d.ts.map +1 -0
- package/dist/agent_api.js +105 -0
- package/dist/agent_api.js.map +1 -0
- package/dist/agent_manifest.d.ts +162 -0
- package/dist/agent_manifest.d.ts.map +1 -0
- package/dist/agent_manifest.js +242 -0
- package/dist/agent_manifest.js.map +1 -0
- package/dist/agent_payloads.d.ts +103 -0
- package/dist/agent_payloads.d.ts.map +1 -0
- package/dist/agent_payloads.js +56 -0
- package/dist/agent_payloads.js.map +1 -0
- package/dist/agents/base_agent.d.ts +113 -0
- package/dist/agents/base_agent.d.ts.map +1 -0
- package/dist/agents/base_agent.js +413 -0
- package/dist/agents/base_agent.js.map +1 -0
- package/dist/agents/cli_agent.d.ts +98 -0
- package/dist/agents/cli_agent.d.ts.map +1 -0
- package/dist/agents/cli_agent.js +303 -0
- package/dist/agents/cli_agent.js.map +1 -0
- package/dist/agents/cli_rehydrate.d.ts +29 -0
- package/dist/agents/cli_rehydrate.d.ts.map +1 -0
- package/dist/agents/cli_rehydrate.js +32 -0
- package/dist/agents/cli_rehydrate.js.map +1 -0
- package/dist/agents/connector_agent.d.ts +20 -0
- package/dist/agents/connector_agent.d.ts.map +1 -0
- package/dist/agents/connector_agent.js +110 -0
- package/dist/agents/connector_agent.js.map +1 -0
- package/dist/agents/event_artifacts.d.ts +33 -0
- package/dist/agents/event_artifacts.d.ts.map +1 -0
- package/dist/agents/event_artifacts.js +73 -0
- package/dist/agents/event_artifacts.js.map +1 -0
- package/dist/agents/gate_agent.d.ts +40 -0
- package/dist/agents/gate_agent.d.ts.map +1 -0
- package/dist/agents/gate_agent.js +121 -0
- package/dist/agents/gate_agent.js.map +1 -0
- package/dist/agents/index.d.ts +32 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +26 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/llm_agent.d.ts +109 -0
- package/dist/agents/llm_agent.d.ts.map +1 -0
- package/dist/agents/llm_agent.js +285 -0
- package/dist/agents/llm_agent.js.map +1 -0
- package/dist/agents/llm_contract.d.ts +7 -0
- package/dist/agents/llm_contract.d.ts.map +1 -0
- package/dist/agents/llm_contract.js +7 -0
- package/dist/agents/llm_contract.js.map +1 -0
- package/dist/agents/standard_agent.d.ts +15 -0
- package/dist/agents/standard_agent.d.ts.map +1 -0
- package/dist/agents/standard_agent.js +34 -0
- package/dist/agents/standard_agent.js.map +1 -0
- package/dist/agents/turn_result.d.ts +67 -0
- package/dist/agents/turn_result.d.ts.map +1 -0
- package/dist/agents/turn_result.js +81 -0
- package/dist/agents/turn_result.js.map +1 -0
- package/dist/agents/types.d.ts +314 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +20 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/builtin_teams/hello_hug.d.ts +9 -0
- package/dist/builtin_teams/hello_hug.d.ts.map +1 -0
- package/dist/builtin_teams/hello_hug.js +68 -0
- package/dist/builtin_teams/hello_hug.js.map +1 -0
- package/dist/builtin_teams/hello_world.d.ts +8 -0
- package/dist/builtin_teams/hello_world.d.ts.map +1 -0
- package/dist/builtin_teams/hello_world.js +65 -0
- package/dist/builtin_teams/hello_world.js.map +1 -0
- package/dist/builtin_teams/hug_example.d.ts +10 -0
- package/dist/builtin_teams/hug_example.d.ts.map +1 -0
- package/dist/builtin_teams/hug_example.js +94 -0
- package/dist/builtin_teams/hug_example.js.map +1 -0
- package/dist/builtin_teams/index.d.ts +12 -0
- package/dist/builtin_teams/index.d.ts.map +1 -0
- package/dist/builtin_teams/index.js +18 -0
- package/dist/builtin_teams/index.js.map +1 -0
- package/dist/builtin_teams/types.d.ts +29 -0
- package/dist/builtin_teams/types.d.ts.map +1 -0
- package/dist/builtin_teams/types.js +3 -0
- package/dist/builtin_teams/types.js.map +1 -0
- package/dist/core_api_client.d.ts +48 -0
- package/dist/core_api_client.d.ts.map +1 -0
- package/dist/core_api_client.js +132 -0
- package/dist/core_api_client.js.map +1 -0
- package/dist/daemon_wire.d.ts +122 -0
- package/dist/daemon_wire.d.ts.map +1 -0
- package/dist/daemon_wire.js +105 -0
- package/dist/daemon_wire.js.map +1 -0
- package/dist/events/catalog.d.ts +40 -0
- package/dist/events/catalog.d.ts.map +1 -0
- package/dist/events/catalog.js +76 -0
- package/dist/events/catalog.js.map +1 -0
- package/dist/http_daemon_client.d.ts +136 -0
- package/dist/http_daemon_client.d.ts.map +1 -0
- package/dist/http_daemon_client.js +192 -0
- package/dist/http_daemon_client.js.map +1 -0
- package/dist/hug/ask.d.ts +160 -0
- package/dist/hug/ask.d.ts.map +1 -0
- package/dist/hug/ask.js +318 -0
- package/dist/hug/ask.js.map +1 -0
- package/dist/hug/attach.d.ts +60 -0
- package/dist/hug/attach.d.ts.map +1 -0
- package/dist/hug/attach.js +103 -0
- package/dist/hug/attach.js.map +1 -0
- package/dist/hug/bridge/index.d.ts +16 -0
- package/dist/hug/bridge/index.d.ts.map +1 -0
- package/dist/hug/bridge/index.js +13 -0
- package/dist/hug/bridge/index.js.map +1 -0
- package/dist/hug/bridge/messages.d.ts +559 -0
- package/dist/hug/bridge/messages.d.ts.map +1 -0
- package/dist/hug/bridge/messages.js +165 -0
- package/dist/hug/bridge/messages.js.map +1 -0
- package/dist/hug/client.d.ts +70 -0
- package/dist/hug/client.d.ts.map +1 -0
- package/dist/hug/client.js +144 -0
- package/dist/hug/client.js.map +1 -0
- package/dist/hug/context.d.ts +54 -0
- package/dist/hug/context.d.ts.map +1 -0
- package/dist/hug/context.js +27 -0
- package/dist/hug/context.js.map +1 -0
- package/dist/hug/define.d.ts +116 -0
- package/dist/hug/define.d.ts.map +1 -0
- package/dist/hug/define.js +119 -0
- package/dist/hug/define.js.map +1 -0
- package/dist/hug/definitions/approval.d.ts +216 -0
- package/dist/hug/definitions/approval.d.ts.map +1 -0
- package/dist/hug/definitions/approval.js +50 -0
- package/dist/hug/definitions/approval.js.map +1 -0
- package/dist/hug/definitions/common.d.ts +122 -0
- package/dist/hug/definitions/common.d.ts.map +1 -0
- package/dist/hug/definitions/common.js +70 -0
- package/dist/hug/definitions/common.js.map +1 -0
- package/dist/hug/definitions/form.d.ts +197 -0
- package/dist/hug/definitions/form.d.ts.map +1 -0
- package/dist/hug/definitions/form.js +29 -0
- package/dist/hug/definitions/form.js.map +1 -0
- package/dist/hug/definitions/index.d.ts +10 -0
- package/dist/hug/definitions/index.d.ts.map +1 -0
- package/dist/hug/definitions/index.js +8 -0
- package/dist/hug/definitions/index.js.map +1 -0
- package/dist/hug/errors.d.ts +30 -0
- package/dist/hug/errors.d.ts.map +1 -0
- package/dist/hug/errors.js +46 -0
- package/dist/hug/errors.js.map +1 -0
- package/dist/hug/file_checks.d.ts +41 -0
- package/dist/hug/file_checks.d.ts.map +1 -0
- package/dist/hug/file_checks.js +105 -0
- package/dist/hug/file_checks.js.map +1 -0
- package/dist/hug/files.d.ts +137 -0
- package/dist/hug/files.d.ts.map +1 -0
- package/dist/hug/files.js +283 -0
- package/dist/hug/files.js.map +1 -0
- package/dist/hug/hug_bundle.d.ts +70 -0
- package/dist/hug/hug_bundle.d.ts.map +1 -0
- package/dist/hug/hug_bundle.js +299 -0
- package/dist/hug/hug_bundle.js.map +1 -0
- package/dist/hug/hug_catalog.d.ts +38 -0
- package/dist/hug/hug_catalog.d.ts.map +1 -0
- package/dist/hug/hug_catalog.js +67 -0
- package/dist/hug/hug_catalog.js.map +1 -0
- package/dist/hug/hug_definitions.d.ts +32 -0
- package/dist/hug/hug_definitions.d.ts.map +1 -0
- package/dist/hug/hug_definitions.js +74 -0
- package/dist/hug/hug_definitions.js.map +1 -0
- package/dist/hug/index.d.ts +37 -0
- package/dist/hug/index.d.ts.map +1 -0
- package/dist/hug/index.js +23 -0
- package/dist/hug/index.js.map +1 -0
- package/dist/hug/llm.d.ts +106 -0
- package/dist/hug/llm.d.ts.map +1 -0
- package/dist/hug/llm.js +250 -0
- package/dist/hug/llm.js.map +1 -0
- package/dist/hug/policies.d.ts +65 -0
- package/dist/hug/policies.d.ts.map +1 -0
- package/dist/hug/policies.js +80 -0
- package/dist/hug/policies.js.map +1 -0
- package/dist/hug/problems.d.ts +35 -0
- package/dist/hug/problems.d.ts.map +1 -0
- package/dist/hug/problems.js +53 -0
- package/dist/hug/problems.js.map +1 -0
- package/dist/hug/requested_inputs.d.ts +190 -0
- package/dist/hug/requested_inputs.d.ts.map +1 -0
- package/dist/hug/requested_inputs.js +220 -0
- package/dist/hug/requested_inputs.js.map +1 -0
- package/dist/hug/schema_for_inputs.d.ts +20 -0
- package/dist/hug/schema_for_inputs.d.ts.map +1 -0
- package/dist/hug/schema_for_inputs.js +95 -0
- package/dist/hug/schema_for_inputs.js.map +1 -0
- package/dist/hug/session.d.ts +113 -0
- package/dist/hug/session.d.ts.map +1 -0
- package/dist/hug/session.js +210 -0
- package/dist/hug/session.js.map +1 -0
- package/dist/hug/types.d.ts +141 -0
- package/dist/hug/types.d.ts.map +1 -0
- package/dist/hug/types.js +80 -0
- package/dist/hug/types.js.map +1 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/logging.d.ts +172 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +306 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp.d.ts +119 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +259 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mcp_client.d.ts +145 -0
- package/dist/mcp_client.d.ts.map +1 -0
- package/dist/mcp_client.js +374 -0
- package/dist/mcp_client.js.map +1 -0
- package/dist/paths.d.ts +20 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +20 -0
- package/dist/paths.js.map +1 -0
- package/dist/protocol/factory.d.ts +32 -0
- package/dist/protocol/factory.d.ts.map +1 -0
- package/dist/protocol/factory.js +31 -0
- package/dist/protocol/factory.js.map +1 -0
- package/dist/protocol/framing.d.ts +35 -0
- package/dist/protocol/framing.d.ts.map +1 -0
- package/dist/protocol/framing.js +73 -0
- package/dist/protocol/framing.js.map +1 -0
- package/dist/protocol/index.d.ts +13 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +13 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/types/agent.d.ts +42 -0
- package/dist/protocol/types/agent.d.ts.map +1 -0
- package/dist/protocol/types/agent.js +9 -0
- package/dist/protocol/types/agent.js.map +1 -0
- package/dist/protocol/types/cliq_core.d.ts +79 -0
- package/dist/protocol/types/cliq_core.d.ts.map +1 -0
- package/dist/protocol/types/cliq_core.js +17 -0
- package/dist/protocol/types/cliq_core.js.map +1 -0
- package/dist/protocol/types/foundations.d.ts +41 -0
- package/dist/protocol/types/foundations.d.ts.map +1 -0
- package/dist/protocol/types/foundations.js +10 -0
- package/dist/protocol/types/foundations.js.map +1 -0
- package/dist/protocol/types/index.d.ts +32 -0
- package/dist/protocol/types/index.d.ts.map +1 -0
- package/dist/protocol/types/index.js +27 -0
- package/dist/protocol/types/index.js.map +1 -0
- package/dist/protocol/types/messages.d.ts +827 -0
- package/dist/protocol/types/messages.d.ts.map +1 -0
- package/dist/protocol/types/messages.js +117 -0
- package/dist/protocol/types/messages.js.map +1 -0
- package/dist/protocol/types/pipeline.d.ts +122 -0
- package/dist/protocol/types/pipeline.d.ts.map +1 -0
- package/dist/protocol/types/pipeline.js +16 -0
- package/dist/protocol/types/pipeline.js.map +1 -0
- package/dist/protocol/types/schemas.d.ts +814 -0
- package/dist/protocol/types/schemas.d.ts.map +1 -0
- package/dist/protocol/types/schemas.js +772 -0
- package/dist/protocol/types/schemas.js.map +1 -0
- package/dist/protocol/types/team.d.ts +42 -0
- package/dist/protocol/types/team.d.ts.map +1 -0
- package/dist/protocol/types/team.js +15 -0
- package/dist/protocol/types/team.js.map +1 -0
- package/dist/protocol/types/workspace.d.ts +46 -0
- package/dist/protocol/types/workspace.d.ts.map +1 -0
- package/dist/protocol/types/workspace.js +9 -0
- package/dist/protocol/types/workspace.js.map +1 -0
- package/dist/settings_keys.d.ts +12 -0
- package/dist/settings_keys.d.ts.map +1 -0
- package/dist/settings_keys.js +35 -0
- package/dist/settings_keys.js.map +1 -0
- package/dist/tcp/client.d.ts +15 -0
- package/dist/tcp/client.d.ts.map +1 -0
- package/dist/tcp/client.js +28 -0
- package/dist/tcp/client.js.map +1 -0
- package/dist/tcp/connection.d.ts +79 -0
- package/dist/tcp/connection.d.ts.map +1 -0
- package/dist/tcp/connection.js +153 -0
- package/dist/tcp/connection.js.map +1 -0
- package/dist/tcp/index.d.ts +10 -0
- package/dist/tcp/index.d.ts.map +1 -0
- package/dist/tcp/index.js +7 -0
- package/dist/tcp/index.js.map +1 -0
- package/dist/tcp/server.d.ts +31 -0
- package/dist/tcp/server.d.ts.map +1 -0
- package/dist/tcp/server.js +54 -0
- package/dist/tcp/server.js.map +1 -0
- package/dist/team/bundle.d.ts +88 -0
- package/dist/team/bundle.d.ts.map +1 -0
- package/dist/team/bundle.js +214 -0
- package/dist/team/bundle.js.map +1 -0
- package/dist/team/identity.d.ts +31 -0
- package/dist/team/identity.d.ts.map +1 -0
- package/dist/team/identity.js +83 -0
- package/dist/team/identity.js.map +1 -0
- package/dist/team/index.d.ts +13 -0
- package/dist/team/index.d.ts.map +1 -0
- package/dist/team/index.js +8 -0
- package/dist/team/index.js.map +1 -0
- package/dist/team/lint_bundle.d.ts +16 -0
- package/dist/team/lint_bundle.d.ts.map +1 -0
- package/dist/team/lint_bundle.js +35 -0
- package/dist/team/lint_bundle.js.map +1 -0
- package/dist/team/ref.d.ts +48 -0
- package/dist/team/ref.d.ts.map +1 -0
- package/dist/team/ref.js +70 -0
- package/dist/team/ref.js.map +1 -0
- package/dist/team/roles.d.ts +22 -0
- package/dist/team/roles.d.ts.map +1 -0
- package/dist/team/roles.js +33 -0
- package/dist/team/roles.js.map +1 -0
- package/dist/team/tree.d.ts +101 -0
- package/dist/team/tree.d.ts.map +1 -0
- package/dist/team/tree.js +125 -0
- package/dist/team/tree.js.map +1 -0
- package/dist/team_lint.d.ts +57 -0
- package/dist/team_lint.d.ts.map +1 -0
- package/dist/team_lint.js +277 -0
- package/dist/team_lint.js.map +1 -0
- package/dist/telemetry/stream_json_usage.d.ts +39 -0
- package/dist/telemetry/stream_json_usage.d.ts.map +1 -0
- package/dist/telemetry/stream_json_usage.js +139 -0
- package/dist/telemetry/stream_json_usage.js.map +1 -0
- package/dist/telemetry/usage.d.ts +288 -0
- package/dist/telemetry/usage.d.ts.map +1 -0
- package/dist/telemetry/usage.js +421 -0
- package/dist/telemetry/usage.js.map +1 -0
- package/dist/utils/duration.d.ts +11 -0
- package/dist/utils/duration.d.ts.map +1 -0
- package/dist/utils/duration.js +22 -0
- package/dist/utils/duration.js.map +1 -0
- package/dist/utils/redact.d.ts +26 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +52 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/url.d.ts +6 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/url.js +11 -0
- package/dist/utils/url.js.map +1 -0
- package/package.json +72 -5
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single home for every Zod schema in the protocol.
|
|
3
|
+
*
|
|
4
|
+
* Bare schema identifiers (`Init`, `Invoke`, `Envelope`, ...) are
|
|
5
|
+
* intentionally NOT exported. The only export is the `schemas`
|
|
6
|
+
* registry — sibling files reach a schema as `schemas.Init`,
|
|
7
|
+
* `schemas.Invoke`, etc.
|
|
8
|
+
*
|
|
9
|
+
* Why this shape:
|
|
10
|
+
*
|
|
11
|
+
* - The bare identifier `Init` is reserved for the public TYPE
|
|
12
|
+
* export (`export type Init = ...` in `workspace.ts`). Having a
|
|
13
|
+
* same-named runtime const elsewhere would be confusing — the
|
|
14
|
+
* two would share an identifier in different namespaces with no
|
|
15
|
+
* visual cue which is which. By naming the runtime carrier
|
|
16
|
+
* `schemas.Init`, the runtime form is always typed as a
|
|
17
|
+
* property access, never as a bare name.
|
|
18
|
+
*
|
|
19
|
+
* - One file means cross-schema composition (`Init` extends
|
|
20
|
+
* `WorkspaceScope`, `RunPipeline` composes `WorkspaceScope` with
|
|
21
|
+
* `TeamScope.shape`, ...) is a local operation — no cross-file
|
|
22
|
+
* imports of schema values, no chance of cycles.
|
|
23
|
+
*
|
|
24
|
+
* - Atom primitives (`non_empty_string`, `finite_number`, ...)
|
|
25
|
+
* stay private to this file. They are implementation detail of
|
|
26
|
+
* how each schema is built; callers never need them.
|
|
27
|
+
*
|
|
28
|
+
* Public consumers should not import from this file. They go
|
|
29
|
+
* through the `protocol/types` barrel for types, and through the
|
|
30
|
+
* `Message` / `Payloads` runtime values in `messages.ts` for
|
|
31
|
+
* validation.
|
|
32
|
+
*/
|
|
33
|
+
import { z } from 'zod';
|
|
34
|
+
// ===========================================================================
|
|
35
|
+
// Atoms — Zod primitives (private to this module)
|
|
36
|
+
// ===========================================================================
|
|
37
|
+
const non_empty_string = z.string().min(1);
|
|
38
|
+
const finite_number = z.number().finite();
|
|
39
|
+
const string_record = z.record(z.string(), z.unknown());
|
|
40
|
+
const entity_id = z.uuid();
|
|
41
|
+
// ===========================================================================
|
|
42
|
+
// Foundation schemas — Empty, Envelope, Ref, Spec
|
|
43
|
+
// ===========================================================================
|
|
44
|
+
/** Wire protocol version. Bumped whenever the envelope shape changes. */
|
|
45
|
+
export const PROTOCOL_VERSION = 1;
|
|
46
|
+
const Empty = z.object({});
|
|
47
|
+
/**
|
|
48
|
+
* Base envelope. Every per-message envelope extends this with a
|
|
49
|
+
* literal `type` and a typed `payload`.
|
|
50
|
+
*/
|
|
51
|
+
const Envelope = z.object({
|
|
52
|
+
version: z.literal(PROTOCOL_VERSION),
|
|
53
|
+
id: non_empty_string,
|
|
54
|
+
timestamp: finite_number,
|
|
55
|
+
run_id: non_empty_string.nullable(),
|
|
56
|
+
instance_id: non_empty_string.nullable(),
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Lookup ref — `{ id?, name? }`, at least one required. The entity
|
|
60
|
+
* type (team, agent, phase, channel) is implied by the parent key
|
|
61
|
+
* in the payload, so a single shape covers every entity.
|
|
62
|
+
*/
|
|
63
|
+
const Ref = z
|
|
64
|
+
.object({
|
|
65
|
+
id: entity_id.optional(),
|
|
66
|
+
name: non_empty_string.optional(),
|
|
67
|
+
})
|
|
68
|
+
.refine((r) => Boolean(r.id) || Boolean(r.name), { message: 'id or name is required', path: ['name'] });
|
|
69
|
+
/**
|
|
70
|
+
* Creation spec — `{ id?, name }`. Name required (the user just
|
|
71
|
+
* typed it), id optional (idempotency / automation-supplied).
|
|
72
|
+
*/
|
|
73
|
+
const Spec = z.object({
|
|
74
|
+
id: entity_id.optional(),
|
|
75
|
+
name: non_empty_string,
|
|
76
|
+
});
|
|
77
|
+
// ===========================================================================
|
|
78
|
+
// Workspace — `WorkspaceScope` plus its extensions
|
|
79
|
+
// ===========================================================================
|
|
80
|
+
const WorkspaceScope = z.object({
|
|
81
|
+
workspace_dir: non_empty_string,
|
|
82
|
+
});
|
|
83
|
+
const workspace_name = z.string()
|
|
84
|
+
.min(1, 'Workspace name cannot be empty')
|
|
85
|
+
.max(64, 'Workspace name cannot exceed 64 characters')
|
|
86
|
+
.regex(/^[a-zA-Z0-9][a-zA-Z0-9 _\-.]*$/, 'Must start with a letter/number; only letters, numbers, spaces, hyphens, underscores, or dots allowed');
|
|
87
|
+
const Init = WorkspaceScope.extend({
|
|
88
|
+
name: workspace_name.optional(),
|
|
89
|
+
});
|
|
90
|
+
/** Structured context for a run: correlation, labels, and team inputs. */
|
|
91
|
+
const RunContext = z.object({
|
|
92
|
+
/** Caller-provided idempotency/correlation key (k8s job UID, CI pipeline ID, etc). */
|
|
93
|
+
id: z.string().max(256).optional(),
|
|
94
|
+
/** Arbitrary key-value metadata about the trigger source. Not passed to agents. */
|
|
95
|
+
labels: z.record(z.string(), z.string()).optional(),
|
|
96
|
+
/** The actual inputs for the team's phases/agents. Available as {{inputs.key}}. */
|
|
97
|
+
inputs: z.record(z.string(), z.unknown()).optional(),
|
|
98
|
+
});
|
|
99
|
+
/** `run` payload — workspace + execution mode + run context. */
|
|
100
|
+
const Run = WorkspaceScope.extend({
|
|
101
|
+
name: z.string().optional(),
|
|
102
|
+
/** When multiple teams are assembled, specify which one to run (scope/slug). */
|
|
103
|
+
team_ref: non_empty_string.optional(),
|
|
104
|
+
execution: z.enum(['docker', 'local']).optional(),
|
|
105
|
+
run_context: RunContext.default({}),
|
|
106
|
+
});
|
|
107
|
+
const Status = z.object({
|
|
108
|
+
workspace_dir: non_empty_string.optional(),
|
|
109
|
+
/** When set, include the assembly-time config snapshot for this team. */
|
|
110
|
+
config_team_ref: non_empty_string.optional(),
|
|
111
|
+
});
|
|
112
|
+
// ===========================================================================
|
|
113
|
+
// Scope — org namespace management
|
|
114
|
+
// ===========================================================================
|
|
115
|
+
// ===========================================================================
|
|
116
|
+
// InputRequired — 206 response when user input is needed to proceed
|
|
117
|
+
// ===========================================================================
|
|
118
|
+
const InputSpec = z.object({
|
|
119
|
+
field: non_empty_string,
|
|
120
|
+
label: non_empty_string,
|
|
121
|
+
input_type: z.enum(['string', 'select']),
|
|
122
|
+
options: z.array(non_empty_string).optional(),
|
|
123
|
+
});
|
|
124
|
+
const InputRequired = z.object({
|
|
125
|
+
required_inputs: z.array(InputSpec).min(1),
|
|
126
|
+
});
|
|
127
|
+
// ===========================================================================
|
|
128
|
+
// Team — `TeamScope` (run-time entity ref, used by `run_pipeline`)
|
|
129
|
+
// ===========================================================================
|
|
130
|
+
/**
|
|
131
|
+
* Entity-style team identity used by run-time messages (`run_pipeline`)
|
|
132
|
+
* where the orchestrator already holds a resolved `Ref`. Distinct from
|
|
133
|
+
* `TeamRef` below, which is the AUTHORING identity (scope + slug)
|
|
134
|
+
* carried by every catalog and assemble verb.
|
|
135
|
+
*/
|
|
136
|
+
const TeamScope = z.object({
|
|
137
|
+
team: Ref,
|
|
138
|
+
});
|
|
139
|
+
// ===========================================================================
|
|
140
|
+
// Team catalog — daemon-managed team definitions (scope + slug + manifest)
|
|
141
|
+
// ===========================================================================
|
|
142
|
+
const OutputFieldSpec = z.object({
|
|
143
|
+
name: non_empty_string,
|
|
144
|
+
type: z.enum(['string', 'number', 'boolean', 'array', 'object']).default('string'),
|
|
145
|
+
description: z.string().optional(),
|
|
146
|
+
required: z.boolean().default(true),
|
|
147
|
+
});
|
|
148
|
+
const OutputSchema = z.object({
|
|
149
|
+
format: z.enum(['json', 'text']).default('text'),
|
|
150
|
+
fields: z.array(OutputFieldSpec).optional(),
|
|
151
|
+
});
|
|
152
|
+
const TeamPhase = z.object({
|
|
153
|
+
name: non_empty_string,
|
|
154
|
+
description: non_empty_string.optional(),
|
|
155
|
+
agent: non_empty_string.optional(),
|
|
156
|
+
type: z.enum(['standard', 'gate', 'team']).optional(),
|
|
157
|
+
depends_on: z.array(non_empty_string).optional(),
|
|
158
|
+
commands: z.array(z.object({ run: non_empty_string })).optional(),
|
|
159
|
+
max_iterations: z.number().int().min(1).max(10).optional(),
|
|
160
|
+
/** Wall-clock limit in seconds. `-1` (default) = no timeout. */
|
|
161
|
+
timeout: z.number().int().min(-1).optional(),
|
|
162
|
+
team: non_empty_string.optional(),
|
|
163
|
+
output: OutputSchema.optional(),
|
|
164
|
+
}).superRefine((phase, ctx) => {
|
|
165
|
+
if (phase.type === 'team') {
|
|
166
|
+
if (!phase.team) {
|
|
167
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "Phase with type 'team' must have a 'team' field", path: ['team'] });
|
|
168
|
+
}
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (!phase.agent) {
|
|
172
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "Phase must specify 'agent'", path: ['agent'] });
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
const TeamManifest = z.object({
|
|
176
|
+
name: non_empty_string.optional(),
|
|
177
|
+
description: non_empty_string.optional(),
|
|
178
|
+
version: non_empty_string.optional(),
|
|
179
|
+
tags: z.array(non_empty_string).optional(),
|
|
180
|
+
use_when: z.array(non_empty_string).optional(),
|
|
181
|
+
not_for: z.array(non_empty_string).optional(),
|
|
182
|
+
outputs: z.array(z.object({
|
|
183
|
+
name: non_empty_string,
|
|
184
|
+
description: z.string().optional(),
|
|
185
|
+
})).optional(),
|
|
186
|
+
phases: z.array(TeamPhase).min(1),
|
|
187
|
+
});
|
|
188
|
+
const TeamRef = z.object({
|
|
189
|
+
scope: non_empty_string,
|
|
190
|
+
slug: non_empty_string,
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Payload of `team_install` (formerly `team_create`): scope + slug
|
|
194
|
+
* identity plus the raw YAML manifest. `version` and `description`
|
|
195
|
+
* are optional metadata at the catalog level — when omitted they may
|
|
196
|
+
* be lifted from the manifest's own fields by the daemon.
|
|
197
|
+
*/
|
|
198
|
+
const TeamInstall = TeamRef.extend({
|
|
199
|
+
manifest: non_empty_string,
|
|
200
|
+
version: non_empty_string.optional(),
|
|
201
|
+
description: non_empty_string.optional(),
|
|
202
|
+
dependencies: non_empty_string.optional(),
|
|
203
|
+
agent_settings: z.record(z.string(), z.record(z.string(), z.string())).optional(),
|
|
204
|
+
force: z.boolean().optional(),
|
|
205
|
+
});
|
|
206
|
+
/** Update has the same shape as install — scope/slug identifies the row, manifest replaces the prior content. */
|
|
207
|
+
const TeamUpdate = TeamInstall;
|
|
208
|
+
const TeamList = z.object({
|
|
209
|
+
scope: non_empty_string.optional(),
|
|
210
|
+
});
|
|
211
|
+
const TeamSearch = z.object({
|
|
212
|
+
query: z.string().optional(),
|
|
213
|
+
page: z.number().int().min(1).optional(),
|
|
214
|
+
per_page: z.number().int().min(1).max(50).optional(),
|
|
215
|
+
});
|
|
216
|
+
const TeamCatalogResult = TeamRef.extend({
|
|
217
|
+
team_id: entity_id,
|
|
218
|
+
version: non_empty_string.optional(),
|
|
219
|
+
description: non_empty_string.optional(),
|
|
220
|
+
manifest: non_empty_string,
|
|
221
|
+
dockerfile: z.string().nullable().optional(),
|
|
222
|
+
created_at: finite_number,
|
|
223
|
+
updated_at: finite_number,
|
|
224
|
+
});
|
|
225
|
+
const TeamCatalogListResult = z.object({
|
|
226
|
+
teams: z.array(TeamCatalogResult),
|
|
227
|
+
});
|
|
228
|
+
const TeamUninstallResult = TeamRef.extend({
|
|
229
|
+
removed: z.boolean(),
|
|
230
|
+
});
|
|
231
|
+
const TeamPublish = TeamRef.extend({
|
|
232
|
+
// Manifest + siblings ship inline with the publish request. The
|
|
233
|
+
// daemon no longer looks the team up in its catalog; the CLI is
|
|
234
|
+
// the source of truth for what gets published.
|
|
235
|
+
manifest: non_empty_string,
|
|
236
|
+
dependencies: non_empty_string.optional(),
|
|
237
|
+
dockerfile: non_empty_string.optional(),
|
|
238
|
+
/** Role files from the team directory (roles/*.md). Shipped as
|
|
239
|
+
* structured data so the daemon can zip them as separate entries
|
|
240
|
+
* and Hub can index them individually. */
|
|
241
|
+
roles: z.array(z.object({
|
|
242
|
+
name: non_empty_string,
|
|
243
|
+
content: non_empty_string,
|
|
244
|
+
})).optional(),
|
|
245
|
+
access: z.enum(['draft', 'public', 'private']).default('public'),
|
|
246
|
+
message: non_empty_string.optional(),
|
|
247
|
+
registry_url: non_empty_string.optional(),
|
|
248
|
+
force: z.boolean().optional(),
|
|
249
|
+
dry_run: z.boolean().optional(),
|
|
250
|
+
});
|
|
251
|
+
const TeamHubInstall = TeamRef.extend({
|
|
252
|
+
version: non_empty_string.optional(),
|
|
253
|
+
force: z.boolean().optional(),
|
|
254
|
+
registry_url: non_empty_string.optional(),
|
|
255
|
+
});
|
|
256
|
+
const TeamHubInstallResult = TeamRef.extend({
|
|
257
|
+
version: non_empty_string.nullable(),
|
|
258
|
+
manifest: non_empty_string,
|
|
259
|
+
});
|
|
260
|
+
const TeamPublishResult = TeamRef.extend({
|
|
261
|
+
version: non_empty_string,
|
|
262
|
+
registry_url: non_empty_string,
|
|
263
|
+
published: z.boolean(),
|
|
264
|
+
});
|
|
265
|
+
// ===========================================================================
|
|
266
|
+
// Workspace ⊕ Team — operations that need both shapes
|
|
267
|
+
// ===========================================================================
|
|
268
|
+
/**
|
|
269
|
+
* Workspace target for assemble / remove-team: path and/or catalog id.
|
|
270
|
+
* At least one of `workspace_dir` / `workspace_id` is required.
|
|
271
|
+
*/
|
|
272
|
+
const WorkspaceTarget = z.object({
|
|
273
|
+
workspace_dir: non_empty_string.optional(),
|
|
274
|
+
workspace_id: entity_id.optional(),
|
|
275
|
+
}).superRefine((data, ctx) => {
|
|
276
|
+
if (data.workspace_dir || data.workspace_id)
|
|
277
|
+
return;
|
|
278
|
+
ctx.addIssue({
|
|
279
|
+
code: 'custom',
|
|
280
|
+
message: 'workspace_dir or workspace_id is required',
|
|
281
|
+
path: ['workspace_dir'],
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
/** Workspace location + structured team ref. Used by `assemble_team`. */
|
|
285
|
+
const AssembleTeam = WorkspaceTarget.extend(TeamRef.shape);
|
|
286
|
+
/** Result of a successful `assemble_team`: workspace + bound team identity. */
|
|
287
|
+
const AssembleTeamResult = z.object({
|
|
288
|
+
workspace_dir: non_empty_string,
|
|
289
|
+
workspace_id: entity_id,
|
|
290
|
+
scope: non_empty_string,
|
|
291
|
+
slug: non_empty_string,
|
|
292
|
+
team_id: entity_id,
|
|
293
|
+
/** True when this team was already assembled in the workspace. */
|
|
294
|
+
already_assembled: z.boolean(),
|
|
295
|
+
/** Total number of teams assembled in this workspace. */
|
|
296
|
+
team_count: z.number().int().min(0),
|
|
297
|
+
});
|
|
298
|
+
/** Unbind a team from a workspace. */
|
|
299
|
+
const WorkspaceRemoveTeam = WorkspaceTarget.extend(TeamRef.shape);
|
|
300
|
+
/** Result of removing a team from a workspace. */
|
|
301
|
+
const WorkspaceRemoveTeamResult = z.object({
|
|
302
|
+
workspace_dir: non_empty_string,
|
|
303
|
+
workspace_id: entity_id.optional(),
|
|
304
|
+
scope: non_empty_string,
|
|
305
|
+
slug: non_empty_string,
|
|
306
|
+
removed: z.boolean(),
|
|
307
|
+
/** Remaining teams assembled in this workspace. */
|
|
308
|
+
remaining_count: z.number().int().min(0),
|
|
309
|
+
});
|
|
310
|
+
// ---------------------------------------------------------------------------
|
|
311
|
+
// Workspace results — response payloads (`ok.data`) for workspace commands.
|
|
312
|
+
// Defined here (after the team catalog) because `StatusResult` composes
|
|
313
|
+
// `TeamRef` to surface the bound team. Reuse the request shapes via
|
|
314
|
+
// `.extend(...)` so the contract composes instead of being redeclared.
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
/** Response of `init`: the resolved workspace, whether `.cliq/` was freshly created, and the catalog id. */
|
|
317
|
+
const InitResult = WorkspaceScope.extend({
|
|
318
|
+
initialized: z.boolean(),
|
|
319
|
+
workspace_id: entity_id,
|
|
320
|
+
});
|
|
321
|
+
/**
|
|
322
|
+
* Response of `status`: a workspace snapshot read from the daemon catalog.
|
|
323
|
+
*
|
|
324
|
+
* `registered` reflects whether a catalog row exists for the path (the
|
|
325
|
+
* DB is the source of truth for state). `exists` is a cheap on-read
|
|
326
|
+
* reconciliation stat — whether the directory is still physically
|
|
327
|
+
* present. `assembled` is true when at least one team is bound.
|
|
328
|
+
* `teams` always carries the full list (empty when none are assembled).
|
|
329
|
+
*/
|
|
330
|
+
const StatusResult = WorkspaceScope.extend({
|
|
331
|
+
registered: z.boolean(),
|
|
332
|
+
exists: z.boolean(),
|
|
333
|
+
workspace_id: entity_id.optional(),
|
|
334
|
+
name: non_empty_string.optional(),
|
|
335
|
+
assembled: z.boolean(),
|
|
336
|
+
/** All teams assembled in this workspace (empty array when none). */
|
|
337
|
+
teams: z.array(TeamRef.extend({ team_id: entity_id })),
|
|
338
|
+
agent_inputs: z.array(z.object({
|
|
339
|
+
name: non_empty_string,
|
|
340
|
+
description: z.string().optional(),
|
|
341
|
+
required: z.boolean().optional(),
|
|
342
|
+
agent: non_empty_string,
|
|
343
|
+
})).optional(),
|
|
344
|
+
last_run: z.object({
|
|
345
|
+
run_id: non_empty_string,
|
|
346
|
+
state: z.enum(['running', 'awaiting_input', 'completed', 'failed', 'cancelled', 'crashed']),
|
|
347
|
+
started_at: finite_number,
|
|
348
|
+
}).optional(),
|
|
349
|
+
active_runs: z.array(z.object({
|
|
350
|
+
run_id: non_empty_string,
|
|
351
|
+
state: z.enum(['running', 'awaiting_input', 'completed', 'failed', 'cancelled', 'crashed']),
|
|
352
|
+
started_at: finite_number,
|
|
353
|
+
})).optional(),
|
|
354
|
+
/** Assembly-time config snapshot — included when `config_team_ref` is set in the request. */
|
|
355
|
+
config_snapshot: z.record(z.string(), z.unknown()).optional(),
|
|
356
|
+
});
|
|
357
|
+
/** Response of `remove` (deregister): drop the catalog row + best-effort Hub delete. */
|
|
358
|
+
const RemoveResult = WorkspaceScope.extend({
|
|
359
|
+
removed: z.boolean(),
|
|
360
|
+
deleted_cliq: z.boolean(),
|
|
361
|
+
/** True when the Hub catalog entry was also removed; false/undefined when Hub was unreachable or unauthenticated. */
|
|
362
|
+
hub_removed: z.boolean().optional(),
|
|
363
|
+
});
|
|
364
|
+
/**
|
|
365
|
+
* Response of `clean`: scrub run-only artifacts from `.cliq/` while
|
|
366
|
+
* preserving workspace identity (settings, name, assembled workflow,
|
|
367
|
+
* catalog row, team binding, requirement).
|
|
368
|
+
*
|
|
369
|
+
* `cleaned` is `true` whenever at least one file or directory was
|
|
370
|
+
* removed; `false` when the workspace was already clean (idempotent).
|
|
371
|
+
* `removed_paths` lists each entry (relative to `.cliq/`) that was
|
|
372
|
+
* actually scrubbed — useful for terminal output and audit.
|
|
373
|
+
*/
|
|
374
|
+
const CleanResult = WorkspaceScope.extend({
|
|
375
|
+
cleaned: z.boolean(),
|
|
376
|
+
removed_paths: z.array(non_empty_string),
|
|
377
|
+
});
|
|
378
|
+
// ===========================================================================
|
|
379
|
+
// Pipeline — orchestration commands and lifecycle events
|
|
380
|
+
// ===========================================================================
|
|
381
|
+
/**
|
|
382
|
+
* A single entry in Output.data. Non-map phases produce a 1-element
|
|
383
|
+
* array; map phases produce N elements, each tagged with `key`.
|
|
384
|
+
*/
|
|
385
|
+
const OutputEntry = z.record(z.string(), z.unknown());
|
|
386
|
+
const Output = z.object({
|
|
387
|
+
text: non_empty_string,
|
|
388
|
+
data: z.array(OutputEntry).optional(),
|
|
389
|
+
/**
|
|
390
|
+
* Optional artifacts for the completing phase (Yamazaki W13).
|
|
391
|
+
* Path refs and/or inline bodies; lifted to top-level event payload.
|
|
392
|
+
*/
|
|
393
|
+
artifacts: z.array(z.union([
|
|
394
|
+
z.object({
|
|
395
|
+
path: non_empty_string,
|
|
396
|
+
label: z.string().optional(),
|
|
397
|
+
mime: z.string().optional(),
|
|
398
|
+
}),
|
|
399
|
+
z.object({
|
|
400
|
+
name: non_empty_string,
|
|
401
|
+
content: z.string(),
|
|
402
|
+
kind: z.enum(['design', 'review', 'handoff', 'output']).optional(),
|
|
403
|
+
mime: z.string().optional(),
|
|
404
|
+
}),
|
|
405
|
+
])).optional(),
|
|
406
|
+
});
|
|
407
|
+
const PhaseOutputMap = z.record(z.string(), Output);
|
|
408
|
+
const Reason = z.object({
|
|
409
|
+
reason: non_empty_string.optional(),
|
|
410
|
+
});
|
|
411
|
+
const PhaseEvent = z.object({
|
|
412
|
+
phase: Ref,
|
|
413
|
+
agent: Ref,
|
|
414
|
+
});
|
|
415
|
+
const PhaseProgress = PhaseEvent.extend({
|
|
416
|
+
message: non_empty_string,
|
|
417
|
+
});
|
|
418
|
+
const PhaseComplete = PhaseEvent.extend({
|
|
419
|
+
duration_ms: finite_number,
|
|
420
|
+
});
|
|
421
|
+
const PhaseError = PhaseEvent.extend({
|
|
422
|
+
error: non_empty_string,
|
|
423
|
+
});
|
|
424
|
+
/**
|
|
425
|
+
* Discriminated union on `outcome`. Each branch carries a `phase`
|
|
426
|
+
* ref. Branches must be raw `z.object` (z.discriminatedUnion rejects
|
|
427
|
+
* refined branches), but a refined ref schema as a NESTED property
|
|
428
|
+
* of an unrefined branch is fine.
|
|
429
|
+
*/
|
|
430
|
+
const GateVerdict = z.discriminatedUnion('outcome', [
|
|
431
|
+
z.object({
|
|
432
|
+
phase: Ref,
|
|
433
|
+
outcome: z.literal('PASS'),
|
|
434
|
+
reason: non_empty_string.optional(),
|
|
435
|
+
}),
|
|
436
|
+
z.object({
|
|
437
|
+
phase: Ref,
|
|
438
|
+
outcome: z.literal('ROUTE'),
|
|
439
|
+
target: non_empty_string,
|
|
440
|
+
reason: non_empty_string.optional(),
|
|
441
|
+
}),
|
|
442
|
+
z.object({
|
|
443
|
+
phase: Ref,
|
|
444
|
+
outcome: z.literal('ESCALATE'),
|
|
445
|
+
reason: non_empty_string.optional(),
|
|
446
|
+
}),
|
|
447
|
+
]);
|
|
448
|
+
const RunPipeline = WorkspaceScope.extend(TeamScope.shape);
|
|
449
|
+
const RunSubPipeline = TeamRef.extend({
|
|
450
|
+
parent_phase: Ref,
|
|
451
|
+
requirement: non_empty_string.optional(),
|
|
452
|
+
upstream: PhaseOutputMap.optional(),
|
|
453
|
+
});
|
|
454
|
+
const Register = z.object({
|
|
455
|
+
orchestrator_port: finite_number,
|
|
456
|
+
pid: finite_number,
|
|
457
|
+
});
|
|
458
|
+
const RunComplete = z.object({
|
|
459
|
+
duration_ms: finite_number,
|
|
460
|
+
});
|
|
461
|
+
const RunFailed = z.object({
|
|
462
|
+
error: non_empty_string,
|
|
463
|
+
failed_phase: Ref.optional(),
|
|
464
|
+
});
|
|
465
|
+
const RunCrashed = z.object({
|
|
466
|
+
error: non_empty_string.optional(),
|
|
467
|
+
});
|
|
468
|
+
const SupplyInputs = z.object({
|
|
469
|
+
run_id: non_empty_string,
|
|
470
|
+
inputs: z.record(z.string(), z.unknown()),
|
|
471
|
+
});
|
|
472
|
+
/** Resume an existing run from a specific phase. */
|
|
473
|
+
const ResumeRun = z.object({
|
|
474
|
+
run_id: non_empty_string,
|
|
475
|
+
from_phase: non_empty_string,
|
|
476
|
+
});
|
|
477
|
+
/** List runs, optionally filtered by workspace. */
|
|
478
|
+
const RunList = z.object({
|
|
479
|
+
workspace_id: z.string().optional(),
|
|
480
|
+
limit: z.number().optional(),
|
|
481
|
+
});
|
|
482
|
+
/** Request the recursive run tree for a given run. */
|
|
483
|
+
const RunsTree = z.object({
|
|
484
|
+
run_id: non_empty_string,
|
|
485
|
+
});
|
|
486
|
+
// ===========================================================================
|
|
487
|
+
// Agent — package management and runtime protocol (invoke / hello)
|
|
488
|
+
// ===========================================================================
|
|
489
|
+
const AgentRef = z.object({
|
|
490
|
+
name: non_empty_string,
|
|
491
|
+
});
|
|
492
|
+
/** `agent_list` — list agents resolved from the local path. */
|
|
493
|
+
const AgentList = z.object({
|
|
494
|
+
/** When true, check each agent's registration status against Hub. */
|
|
495
|
+
check_reg: z.boolean().optional(),
|
|
496
|
+
});
|
|
497
|
+
/** `agent_register` — resolve local agent and push manifest to Hub. */
|
|
498
|
+
const AgentRegister = z.object({
|
|
499
|
+
name: non_empty_string,
|
|
500
|
+
/** Absolute path to agent directory. When set, reads manifest from this path instead of resolving by name. */
|
|
501
|
+
path: non_empty_string.optional(),
|
|
502
|
+
force: z.boolean().optional(),
|
|
503
|
+
});
|
|
504
|
+
/** `agent_get_by_id` — resolve a single agent by name from the local path. */
|
|
505
|
+
const AgentGetById = z.object({
|
|
506
|
+
name: non_empty_string,
|
|
507
|
+
});
|
|
508
|
+
/** `agent_unregister` — remove an agent from the Hub registry. */
|
|
509
|
+
const AgentUnregister = z.object({
|
|
510
|
+
name: non_empty_string,
|
|
511
|
+
version: non_empty_string.optional(),
|
|
512
|
+
});
|
|
513
|
+
/**
|
|
514
|
+
* A command IS the entity (not a reference to one), so its identity
|
|
515
|
+
* fields live directly on the schema as `id` and `name`.
|
|
516
|
+
*/
|
|
517
|
+
const Command = z.object({
|
|
518
|
+
id: entity_id.optional(),
|
|
519
|
+
name: non_empty_string.optional(),
|
|
520
|
+
run: non_empty_string,
|
|
521
|
+
/** false: a non-zero exit is logged and the next command runs. Unset or true (default): the phase fails. */
|
|
522
|
+
escalate_on_fail: z.boolean().optional(),
|
|
523
|
+
});
|
|
524
|
+
const PhaseType = z.enum(['STANDARD', 'GATE', 'NOTIFY']);
|
|
525
|
+
/**
|
|
526
|
+
* The orchestrator dispatches a phase to an agent with this payload.
|
|
527
|
+
*
|
|
528
|
+
* `requirement` is intentionally permissive (`z.string()` not
|
|
529
|
+
* `non_empty_string`) — empty is valid when no requirement is set.
|
|
530
|
+
*/
|
|
531
|
+
const Invoke = z.object({
|
|
532
|
+
agent: Ref,
|
|
533
|
+
phase: Ref,
|
|
534
|
+
phase_type: PhaseType,
|
|
535
|
+
role: non_empty_string,
|
|
536
|
+
requirement: z.string(),
|
|
537
|
+
upstream: PhaseOutputMap,
|
|
538
|
+
config: string_record,
|
|
539
|
+
commands: z.array(Command),
|
|
540
|
+
settings: string_record,
|
|
541
|
+
inputs: string_record.optional(),
|
|
542
|
+
project_dir: non_empty_string,
|
|
543
|
+
work_dir: non_empty_string,
|
|
544
|
+
check_results: z.array(z.string()).optional(),
|
|
545
|
+
route_targets: z.array(z.string()).optional(),
|
|
546
|
+
iteration: finite_number.optional(),
|
|
547
|
+
max_iterations: finite_number.optional(),
|
|
548
|
+
event: non_empty_string.optional(),
|
|
549
|
+
event_data: string_record.optional(),
|
|
550
|
+
output_schema: OutputSchema.optional(),
|
|
551
|
+
manifest_events: z.array(z.string()).optional(),
|
|
552
|
+
/** Rehydrated transcript turns for multi-turn agents (Yamazaki). */
|
|
553
|
+
messages: z.array(z.object({
|
|
554
|
+
role: non_empty_string,
|
|
555
|
+
content: z.string(),
|
|
556
|
+
})).optional(),
|
|
557
|
+
/** Opaque agent cursor across a wait and its resume. */
|
|
558
|
+
checkpoint: z.object({
|
|
559
|
+
version: finite_number,
|
|
560
|
+
agent_data: z.unknown().optional(),
|
|
561
|
+
}).optional(),
|
|
562
|
+
/**
|
|
563
|
+
* A resume after a wait on Hugs (PLAN-hug-requests §8.5): each Hug's saved requester state and
|
|
564
|
+
* the events it hasn't processed.
|
|
565
|
+
*/
|
|
566
|
+
resume: z.object({
|
|
567
|
+
hugs: z.array(z.object({
|
|
568
|
+
hug_id: non_empty_string,
|
|
569
|
+
status: z.enum(['open', 'closed', 'expired', 'cancelled']),
|
|
570
|
+
state: z.unknown(),
|
|
571
|
+
processed_seq: z.number().int().nonnegative(),
|
|
572
|
+
events: z.array(z.record(z.string(), z.unknown())),
|
|
573
|
+
})),
|
|
574
|
+
}).optional(),
|
|
575
|
+
});
|
|
576
|
+
/**
|
|
577
|
+
* First message an agent sends after connecting. The agent ref is
|
|
578
|
+
* required; the phase ref is optional (the agent may not yet know
|
|
579
|
+
* which phase it's about to run at connection setup).
|
|
580
|
+
*/
|
|
581
|
+
const Hello = z.object({
|
|
582
|
+
agent: Ref,
|
|
583
|
+
phase: Ref.optional(),
|
|
584
|
+
});
|
|
585
|
+
// ===========================================================================
|
|
586
|
+
// Cliq Core — daemon-side concerns
|
|
587
|
+
// ===========================================================================
|
|
588
|
+
const InstanceScope = z.object({
|
|
589
|
+
instance_id: non_empty_string,
|
|
590
|
+
});
|
|
591
|
+
const SettingsGet = WorkspaceScope.extend({
|
|
592
|
+
workspace_dir: non_empty_string.nullable(),
|
|
593
|
+
key: non_empty_string,
|
|
594
|
+
});
|
|
595
|
+
const SettingsList = WorkspaceScope.extend({
|
|
596
|
+
workspace_dir: non_empty_string.nullable(),
|
|
597
|
+
prefix: non_empty_string.optional(),
|
|
598
|
+
});
|
|
599
|
+
/**
|
|
600
|
+
* `settings_set` requires the `value` key to be present. `null` is
|
|
601
|
+
* allowed (it explicitly clears the setting), but a missing or
|
|
602
|
+
* undefined `value` is rejected. Zod strips `undefined` values from
|
|
603
|
+
* parsed objects, so the `superRefine` check on `'value' in data`
|
|
604
|
+
* cleanly distinguishes present-with-null from absent.
|
|
605
|
+
*/
|
|
606
|
+
const SettingsSet = WorkspaceScope.extend({
|
|
607
|
+
workspace_dir: non_empty_string.nullable(),
|
|
608
|
+
key: non_empty_string,
|
|
609
|
+
value: z.unknown().optional(),
|
|
610
|
+
}).superRefine((data, ctx) => {
|
|
611
|
+
if (!('value' in data)) {
|
|
612
|
+
ctx.addIssue({
|
|
613
|
+
code: 'custom',
|
|
614
|
+
path: ['value'],
|
|
615
|
+
message: 'is required (use null to clear)',
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
const HubLogin = z.object({
|
|
620
|
+
/** Provider-specific credentials. Daemon dispatches on key shape. */
|
|
621
|
+
credentials: string_record,
|
|
622
|
+
});
|
|
623
|
+
const TokenCreate = z.object({
|
|
624
|
+
label: non_empty_string,
|
|
625
|
+
/** Token type: 'user' (default) or 'realm' (daemon enrollment). */
|
|
626
|
+
type: z.enum(['user', 'realm']).optional(),
|
|
627
|
+
/** Required when type is 'realm' — the realm to scope the token to. */
|
|
628
|
+
realm_id: non_empty_string.optional(),
|
|
629
|
+
});
|
|
630
|
+
const TokenRevoke = z.object({
|
|
631
|
+
token_id: non_empty_string,
|
|
632
|
+
});
|
|
633
|
+
/** Rotate the dispatch key pair for a realm. */
|
|
634
|
+
const RotateDispatch = z.object({
|
|
635
|
+
realm_id: non_empty_string,
|
|
636
|
+
});
|
|
637
|
+
const LogLevel = z.enum(['DEBUG', 'INFO', 'WARN', 'ERROR']);
|
|
638
|
+
const Log = z.object({
|
|
639
|
+
level: LogLevel,
|
|
640
|
+
message: non_empty_string,
|
|
641
|
+
phase: Ref.optional(),
|
|
642
|
+
agent: Ref.optional(),
|
|
643
|
+
/** Free-form structured fields attached to the log line. */
|
|
644
|
+
data: string_record.optional(),
|
|
645
|
+
});
|
|
646
|
+
const Notification = z.object({
|
|
647
|
+
channel: Ref,
|
|
648
|
+
subject: non_empty_string,
|
|
649
|
+
/** May be empty (a header-only notification). */
|
|
650
|
+
body: z.string(),
|
|
651
|
+
});
|
|
652
|
+
/** Agent → orchestrator: emit a custom event to the Hub notification pipeline. */
|
|
653
|
+
const EmitEvent = z.object({
|
|
654
|
+
custom_type: non_empty_string,
|
|
655
|
+
message: non_empty_string,
|
|
656
|
+
phase: Ref.optional(),
|
|
657
|
+
agent: Ref.optional(),
|
|
658
|
+
});
|
|
659
|
+
const Ok = z.object({
|
|
660
|
+
data: string_record.optional(),
|
|
661
|
+
});
|
|
662
|
+
const Err = z.object({
|
|
663
|
+
code: non_empty_string,
|
|
664
|
+
message: non_empty_string,
|
|
665
|
+
/** Optional structured detail (validation issue list, stack, etc.). */
|
|
666
|
+
details: z.unknown().optional(),
|
|
667
|
+
});
|
|
668
|
+
const Progress = z.object({
|
|
669
|
+
message: non_empty_string,
|
|
670
|
+
/** Optional 0–100 indicator. Validators only check it's finite. */
|
|
671
|
+
percent: finite_number.optional(),
|
|
672
|
+
});
|
|
673
|
+
// ===========================================================================
|
|
674
|
+
// Registry — the single export
|
|
675
|
+
// ===========================================================================
|
|
676
|
+
/**
|
|
677
|
+
* Every schema, keyed by PascalCase identifier. Sibling files reach
|
|
678
|
+
* a schema as `schemas.Init`, `schemas.Invoke`, etc. — there is no
|
|
679
|
+
* bare-name route to any schema.
|
|
680
|
+
*/
|
|
681
|
+
export const schemas = {
|
|
682
|
+
// Foundation
|
|
683
|
+
Empty,
|
|
684
|
+
Envelope,
|
|
685
|
+
Ref,
|
|
686
|
+
Spec,
|
|
687
|
+
// Workspace
|
|
688
|
+
WorkspaceScope,
|
|
689
|
+
Init,
|
|
690
|
+
RunContext,
|
|
691
|
+
Run,
|
|
692
|
+
Status,
|
|
693
|
+
// Workspace results
|
|
694
|
+
InitResult,
|
|
695
|
+
StatusResult,
|
|
696
|
+
RemoveResult,
|
|
697
|
+
CleanResult,
|
|
698
|
+
// Input Required (206)
|
|
699
|
+
InputSpec,
|
|
700
|
+
InputRequired,
|
|
701
|
+
// Team (run-time entity ref, used by `run_pipeline`)
|
|
702
|
+
TeamScope,
|
|
703
|
+
// Team catalog (daemon-managed, scope + slug + manifest)
|
|
704
|
+
OutputFieldSpec,
|
|
705
|
+
OutputSchema,
|
|
706
|
+
TeamPhase,
|
|
707
|
+
TeamManifest,
|
|
708
|
+
TeamRef,
|
|
709
|
+
TeamInstall,
|
|
710
|
+
TeamUpdate,
|
|
711
|
+
TeamList,
|
|
712
|
+
TeamSearch,
|
|
713
|
+
TeamCatalogResult,
|
|
714
|
+
TeamCatalogListResult,
|
|
715
|
+
TeamUninstallResult,
|
|
716
|
+
TeamPublish,
|
|
717
|
+
TeamPublishResult,
|
|
718
|
+
TeamHubInstall,
|
|
719
|
+
TeamHubInstallResult,
|
|
720
|
+
// Workspace ⊕ Team
|
|
721
|
+
AssembleTeam,
|
|
722
|
+
AssembleTeamResult,
|
|
723
|
+
WorkspaceRemoveTeam,
|
|
724
|
+
WorkspaceRemoveTeamResult,
|
|
725
|
+
// Pipeline
|
|
726
|
+
OutputEntry,
|
|
727
|
+
Output,
|
|
728
|
+
PhaseOutputMap,
|
|
729
|
+
Reason,
|
|
730
|
+
PhaseEvent,
|
|
731
|
+
PhaseProgress,
|
|
732
|
+
PhaseComplete,
|
|
733
|
+
PhaseError,
|
|
734
|
+
GateVerdict,
|
|
735
|
+
RunPipeline,
|
|
736
|
+
RunSubPipeline,
|
|
737
|
+
Register,
|
|
738
|
+
RunComplete,
|
|
739
|
+
RunFailed,
|
|
740
|
+
RunCrashed,
|
|
741
|
+
SupplyInputs,
|
|
742
|
+
ResumeRun,
|
|
743
|
+
RunList,
|
|
744
|
+
RunsTree,
|
|
745
|
+
// Agent
|
|
746
|
+
AgentRef,
|
|
747
|
+
AgentList,
|
|
748
|
+
AgentRegister,
|
|
749
|
+
AgentGetById,
|
|
750
|
+
AgentUnregister,
|
|
751
|
+
Command,
|
|
752
|
+
PhaseType,
|
|
753
|
+
Invoke,
|
|
754
|
+
Hello,
|
|
755
|
+
// Cliq Core
|
|
756
|
+
InstanceScope,
|
|
757
|
+
SettingsGet,
|
|
758
|
+
SettingsList,
|
|
759
|
+
SettingsSet,
|
|
760
|
+
HubLogin,
|
|
761
|
+
TokenCreate,
|
|
762
|
+
TokenRevoke,
|
|
763
|
+
RotateDispatch,
|
|
764
|
+
LogLevel,
|
|
765
|
+
Log,
|
|
766
|
+
Notification,
|
|
767
|
+
EmitEvent,
|
|
768
|
+
Ok,
|
|
769
|
+
Err,
|
|
770
|
+
Progress,
|
|
771
|
+
};
|
|
772
|
+
//# sourceMappingURL=schemas.js.map
|