@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,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HugSession — one open Hug from the requester's side (PLAN-hug-requests §10.1).
|
|
3
|
+
*
|
|
4
|
+
* A session keeps the latest response per responder and how far it has processed, and saves both
|
|
5
|
+
* with cliqd (`save_state`) so a restarted agent picks up where it left off: at open, when the
|
|
6
|
+
* caller asks for the next event (the previous one is then processed), and before close.
|
|
7
|
+
*
|
|
8
|
+
* Its saved state is an envelope ({@link SessionState}): the SDK's bookkeeping plus whatever the
|
|
9
|
+
* agent stores with {@link HugSession.save_state}.
|
|
10
|
+
*/
|
|
11
|
+
import type { HugClient } from './client.js';
|
|
12
|
+
import type { PolicyDescriptor } from './policies.js';
|
|
13
|
+
import { type HugEvent, type HugResponse, type HugResumeEntry, type HugSpec, type HugStatus } from './types.js';
|
|
14
|
+
/** What a session saves with cliqd (opaque to cliqd). */
|
|
15
|
+
export interface SessionState {
|
|
16
|
+
readonly v: 1;
|
|
17
|
+
/** The `ctx.ask` call this Hug belongs to (`<phase>#<iteration>#ask<n>`), when it came from one. */
|
|
18
|
+
readonly request_id: string | null;
|
|
19
|
+
readonly spec: HugSpec;
|
|
20
|
+
/** Latest response per responder, so far. */
|
|
21
|
+
readonly responses: readonly HugResponse[];
|
|
22
|
+
/** The `ctx.ask` that opened it: its policy when it has no code (else null) and how it waits. */
|
|
23
|
+
readonly ask: {
|
|
24
|
+
readonly policy: PolicyDescriptor | null;
|
|
25
|
+
readonly mode: 'block' | 'yield';
|
|
26
|
+
} | null;
|
|
27
|
+
/** The agent's own state. */
|
|
28
|
+
readonly user?: unknown;
|
|
29
|
+
/** How the requester settled it, saved at close: a replayed `ctx.ask` returns (or throws) this. */
|
|
30
|
+
readonly result?: SettledResult;
|
|
31
|
+
}
|
|
32
|
+
/** A settled policy result, as saved with the Hug. */
|
|
33
|
+
export type SettledResult = {
|
|
34
|
+
readonly kind: 'done';
|
|
35
|
+
readonly outcome: string;
|
|
36
|
+
readonly value: unknown;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'failed';
|
|
39
|
+
readonly reason: string;
|
|
40
|
+
readonly response?: HugResponse;
|
|
41
|
+
};
|
|
42
|
+
/** One open Hug, as its requester sees it. */
|
|
43
|
+
export declare class HugSession {
|
|
44
|
+
private readonly _client;
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly spec: HugSpec;
|
|
47
|
+
readonly request_id: string | null;
|
|
48
|
+
readonly ask: SessionState['ask'];
|
|
49
|
+
private _status;
|
|
50
|
+
private _responses;
|
|
51
|
+
private _user;
|
|
52
|
+
private _result;
|
|
53
|
+
/** Highest seq handed to the caller, and highest saved as processed. */
|
|
54
|
+
private _returned_seq;
|
|
55
|
+
private _saved_seq;
|
|
56
|
+
/** Events received but not yet handed to the caller, in seq order. */
|
|
57
|
+
private readonly _pending;
|
|
58
|
+
private constructor();
|
|
59
|
+
/** A session for a Hug just opened. */
|
|
60
|
+
static opened(client: HugClient, hug_id: string, spec: HugSpec, request_id: string | null, ask: SessionState['ask'], user?: unknown): HugSession;
|
|
61
|
+
/** A session rebuilt from an invoke's `resume.hugs` entry (§8.5). */
|
|
62
|
+
static restore(client: HugClient, entry: HugResumeEntry): HugSession;
|
|
63
|
+
/** Where the Hug is in its life, as far as this session knows. */
|
|
64
|
+
get status(): HugStatus;
|
|
65
|
+
/** The agent's saved state (from {@link save_state}, or restored on resume). */
|
|
66
|
+
get user_state(): unknown;
|
|
67
|
+
/** Responses known so far (latest per responder). */
|
|
68
|
+
responses(): HugResponse[];
|
|
69
|
+
/** How the requester settled it (saved at close), if it did. */
|
|
70
|
+
get result(): SettledResult | undefined;
|
|
71
|
+
/** Whether an event is already here (no wait). */
|
|
72
|
+
has_pending(): boolean;
|
|
73
|
+
/** Ended, with nothing left to process: a resume has nothing new for it. */
|
|
74
|
+
idle(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The next unprocessed event — one already here, or a long-poll until one arrives or `until`
|
|
77
|
+
* (ms since epoch) passes. Null on timeout, and once the Hug has ended and every event was
|
|
78
|
+
* handed out. Asking for the next event marks the previous one processed.
|
|
79
|
+
*/
|
|
80
|
+
next(opts?: {
|
|
81
|
+
until?: number;
|
|
82
|
+
}): Promise<HugEvent | null>;
|
|
83
|
+
/** One long-poll: queue new events in seq order; note the Hug's end once nothing is left. */
|
|
84
|
+
private _poll;
|
|
85
|
+
/** The next event already here, without waiting (null when none). */
|
|
86
|
+
take_pending(): HugEvent | null;
|
|
87
|
+
/**
|
|
88
|
+
* Save the agent's state (and mark every event handed out so far processed).
|
|
89
|
+
*
|
|
90
|
+
* @throws HugRefusedError when the state is larger than {@link MAX_STATE_BYTES}
|
|
91
|
+
*/
|
|
92
|
+
save_state(user?: unknown): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* The requester's status line for the people answering ("1 answer couldn't be used; waiting for a valid one"),
|
|
95
|
+
* shown on the Hug page while the Hug is open (PLAN-hug-widgets §6.1 `progress`); null clears it. Informational
|
|
96
|
+
* and best effort: a line that can't be sent is dropped.
|
|
97
|
+
*/
|
|
98
|
+
set_progress(line: string | null): Promise<void>;
|
|
99
|
+
/** End the Hug with its outcome (idempotent), saving how it was settled. */
|
|
100
|
+
close(outcome: string, result?: SettledResult): Promise<void>;
|
|
101
|
+
/** The envelope saved with cliqd. */
|
|
102
|
+
state(): SessionState;
|
|
103
|
+
private _save_processed;
|
|
104
|
+
private _apply;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Refuse agent state larger than {@link MAX_STATE_BYTES} (serialized): it is kept with every Hug it
|
|
108
|
+
* belongs to, so big data belongs in files or artifacts.
|
|
109
|
+
*
|
|
110
|
+
* @throws HugRefusedError
|
|
111
|
+
*/
|
|
112
|
+
export declare function assert_state_size(state: unknown): void;
|
|
113
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/hug/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAmB,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAEjI,yDAAyD;AACzD,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,oGAAoG;IACpG,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CA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B,OAAO,CAAC,MAAM;CAUjB;AAcD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMtD"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HugSession — one open Hug from the requester's side (PLAN-hug-requests §10.1).
|
|
3
|
+
*
|
|
4
|
+
* A session keeps the latest response per responder and how far it has processed, and saves both
|
|
5
|
+
* with cliqd (`save_state`) so a restarted agent picks up where it left off: at open, when the
|
|
6
|
+
* caller asks for the next event (the previous one is then processed), and before close.
|
|
7
|
+
*
|
|
8
|
+
* Its saved state is an envelope ({@link SessionState}): the SDK's bookkeeping plus whatever the
|
|
9
|
+
* agent stores with {@link HugSession.save_state}.
|
|
10
|
+
*/
|
|
11
|
+
import { HugRefusedError } from './errors.js';
|
|
12
|
+
import { MAX_STATE_BYTES } from './types.js';
|
|
13
|
+
/** One open Hug, as its requester sees it. */
|
|
14
|
+
export class HugSession {
|
|
15
|
+
_client;
|
|
16
|
+
id;
|
|
17
|
+
spec;
|
|
18
|
+
request_id;
|
|
19
|
+
ask;
|
|
20
|
+
_status;
|
|
21
|
+
_responses;
|
|
22
|
+
_user;
|
|
23
|
+
_result;
|
|
24
|
+
/** Highest seq handed to the caller, and highest saved as processed. */
|
|
25
|
+
_returned_seq;
|
|
26
|
+
_saved_seq;
|
|
27
|
+
/** Events received but not yet handed to the caller, in seq order. */
|
|
28
|
+
_pending;
|
|
29
|
+
constructor(_client, id, spec, request_id, ask, init) {
|
|
30
|
+
this._client = _client;
|
|
31
|
+
this.id = id;
|
|
32
|
+
this.spec = spec;
|
|
33
|
+
this.request_id = request_id;
|
|
34
|
+
this.ask = ask;
|
|
35
|
+
this._status = init.status;
|
|
36
|
+
this._responses = init.responses;
|
|
37
|
+
this._user = init.user;
|
|
38
|
+
this._result = init.result;
|
|
39
|
+
this._returned_seq = init.processed_seq;
|
|
40
|
+
this._saved_seq = init.processed_seq;
|
|
41
|
+
this._pending = [...init.pending].sort((a, b) => a.seq - b.seq);
|
|
42
|
+
}
|
|
43
|
+
/** A session for a Hug just opened. */
|
|
44
|
+
static opened(client, hug_id, spec, request_id, ask, user) {
|
|
45
|
+
return new HugSession(client, hug_id, spec, request_id, ask, { status: 'open', responses: [], user, processed_seq: 0, pending: [] });
|
|
46
|
+
}
|
|
47
|
+
/** A session rebuilt from an invoke's `resume.hugs` entry (§8.5). */
|
|
48
|
+
static restore(client, entry) {
|
|
49
|
+
const state = as_state(entry.state);
|
|
50
|
+
return new HugSession(client, entry.hug_id, saved_spec(state?.spec), state?.request_id ?? null, state?.ask ?? null, {
|
|
51
|
+
status: entry.status,
|
|
52
|
+
responses: [...(state?.responses ?? [])],
|
|
53
|
+
user: state?.user,
|
|
54
|
+
processed_seq: entry.processed_seq,
|
|
55
|
+
pending: entry.events.filter((e) => e.seq > entry.processed_seq),
|
|
56
|
+
...(state?.result ? { result: state.result } : {}),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** Where the Hug is in its life, as far as this session knows. */
|
|
60
|
+
get status() {
|
|
61
|
+
return this._status;
|
|
62
|
+
}
|
|
63
|
+
/** The agent's saved state (from {@link save_state}, or restored on resume). */
|
|
64
|
+
get user_state() {
|
|
65
|
+
return this._user;
|
|
66
|
+
}
|
|
67
|
+
/** Responses known so far (latest per responder). */
|
|
68
|
+
responses() {
|
|
69
|
+
return [...this._responses];
|
|
70
|
+
}
|
|
71
|
+
/** How the requester settled it (saved at close), if it did. */
|
|
72
|
+
get result() {
|
|
73
|
+
return this._result;
|
|
74
|
+
}
|
|
75
|
+
/** Whether an event is already here (no wait). */
|
|
76
|
+
has_pending() {
|
|
77
|
+
return this._pending.length > 0;
|
|
78
|
+
}
|
|
79
|
+
/** Ended, with nothing left to process: a resume has nothing new for it. */
|
|
80
|
+
idle() {
|
|
81
|
+
return this._status !== 'open' && this._pending.length === 0;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The next unprocessed event — one already here, or a long-poll until one arrives or `until`
|
|
85
|
+
* (ms since epoch) passes. Null on timeout, and once the Hug has ended and every event was
|
|
86
|
+
* handed out. Asking for the next event marks the previous one processed.
|
|
87
|
+
*/
|
|
88
|
+
async next(opts = {}) {
|
|
89
|
+
await this._save_processed();
|
|
90
|
+
for (;;) {
|
|
91
|
+
const event = this._pending.shift();
|
|
92
|
+
if (event)
|
|
93
|
+
return this._apply(event);
|
|
94
|
+
if (this._status !== 'open')
|
|
95
|
+
return null;
|
|
96
|
+
if (opts.until !== undefined && Date.now() >= opts.until)
|
|
97
|
+
return null;
|
|
98
|
+
await this._poll(opts.until);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** One long-poll: queue new events in seq order; note the Hug's end once nothing is left. */
|
|
102
|
+
async _poll(until) {
|
|
103
|
+
const wait_ms = until === undefined ? 25_000 : Math.max(0, until - Date.now());
|
|
104
|
+
const reply = await this._client.next([this.id], { [this.id]: this._returned_seq }, wait_ms);
|
|
105
|
+
for (const e of reply.events) {
|
|
106
|
+
const fresh = e.hug_id === this.id && e.seq > this._returned_seq && !this._pending.some((p) => p.seq === e.seq);
|
|
107
|
+
if (fresh)
|
|
108
|
+
this._pending.push(e);
|
|
109
|
+
}
|
|
110
|
+
this._pending.sort((a, b) => a.seq - b.seq);
|
|
111
|
+
const status = reply.hugs.find((h) => h.hug_id === this.id)?.status;
|
|
112
|
+
if (status && status !== 'open' && this._pending.length === 0)
|
|
113
|
+
this._status = status;
|
|
114
|
+
}
|
|
115
|
+
/** The next event already here, without waiting (null when none). */
|
|
116
|
+
take_pending() {
|
|
117
|
+
const event = this._pending.shift();
|
|
118
|
+
return event ? this._apply(event) : null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Save the agent's state (and mark every event handed out so far processed).
|
|
122
|
+
*
|
|
123
|
+
* @throws HugRefusedError when the state is larger than {@link MAX_STATE_BYTES}
|
|
124
|
+
*/
|
|
125
|
+
async save_state(user) {
|
|
126
|
+
if (user !== undefined) {
|
|
127
|
+
assert_state_size(user);
|
|
128
|
+
this._user = user;
|
|
129
|
+
}
|
|
130
|
+
await this._client.save_state(this.id, this.state(), this._returned_seq);
|
|
131
|
+
this._saved_seq = this._returned_seq;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The requester's status line for the people answering ("1 answer couldn't be used; waiting for a valid one"),
|
|
135
|
+
* shown on the Hug page while the Hug is open (PLAN-hug-widgets §6.1 `progress`); null clears it. Informational
|
|
136
|
+
* and best effort: a line that can't be sent is dropped.
|
|
137
|
+
*/
|
|
138
|
+
async set_progress(line) {
|
|
139
|
+
const text = line === null ? null : line.replace(/\s+/g, ' ').trim().slice(0, 200) || null;
|
|
140
|
+
try {
|
|
141
|
+
await this._client.save_state(this.id, this.state(), this._returned_seq, text);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// Informational only: the Hug works the same without it.
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/** End the Hug with its outcome (idempotent), saving how it was settled. */
|
|
148
|
+
async close(outcome, result) {
|
|
149
|
+
if (result)
|
|
150
|
+
this._result = result;
|
|
151
|
+
await this.save_state();
|
|
152
|
+
if (this._status === 'open')
|
|
153
|
+
await this._client.close(this.id, outcome);
|
|
154
|
+
if (this._status === 'open')
|
|
155
|
+
this._status = 'closed';
|
|
156
|
+
}
|
|
157
|
+
/** The envelope saved with cliqd. */
|
|
158
|
+
state() {
|
|
159
|
+
return {
|
|
160
|
+
v: 1,
|
|
161
|
+
request_id: this.request_id,
|
|
162
|
+
spec: this.spec,
|
|
163
|
+
responses: this._responses,
|
|
164
|
+
ask: this.ask,
|
|
165
|
+
...(this._user === undefined ? {} : { user: this._user }),
|
|
166
|
+
...(this._result === undefined ? {} : { result: this._result }),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
async _save_processed() {
|
|
170
|
+
if (this._returned_seq > this._saved_seq)
|
|
171
|
+
await this.save_state();
|
|
172
|
+
}
|
|
173
|
+
_apply(event) {
|
|
174
|
+
this._returned_seq = Math.max(this._returned_seq, event.seq);
|
|
175
|
+
if (event.type === 'response') {
|
|
176
|
+
const who = event.response.responder.user_id;
|
|
177
|
+
this._responses = [...this._responses.filter((r) => r.responder.user_id !== who), event.response];
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this._status = event.type;
|
|
181
|
+
}
|
|
182
|
+
return event;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/** A saved spec; one saved without a spec (state that isn't the SDK's) is a `form`. */
|
|
186
|
+
function saved_spec(spec) {
|
|
187
|
+
return spec ?? { title: '', params: {}, hug: { name: 'form' } };
|
|
188
|
+
}
|
|
189
|
+
/** A saved envelope, or null when the state isn't one of the SDK's. */
|
|
190
|
+
function as_state(raw) {
|
|
191
|
+
if (!raw || typeof raw !== 'object')
|
|
192
|
+
return null;
|
|
193
|
+
const s = raw;
|
|
194
|
+
return s.v === 1 && s.spec ? s : null;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Refuse agent state larger than {@link MAX_STATE_BYTES} (serialized): it is kept with every Hug it
|
|
198
|
+
* belongs to, so big data belongs in files or artifacts.
|
|
199
|
+
*
|
|
200
|
+
* @throws HugRefusedError
|
|
201
|
+
*/
|
|
202
|
+
export function assert_state_size(state) {
|
|
203
|
+
if (state === undefined)
|
|
204
|
+
return;
|
|
205
|
+
const bytes = Buffer.byteLength(JSON.stringify(state) ?? '', 'utf8');
|
|
206
|
+
if (bytes > MAX_STATE_BYTES) {
|
|
207
|
+
throw new HugRefusedError(`Hug state is ${bytes} bytes; at most ${MAX_STATE_BYTES} are kept — store large data in files or artifacts`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/hug/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE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AAI,EAAE,MAAM,EAAE,EAAE,CAAC;AACpE,CAAC;AAED,uEAAuE;AACvE,SAAS,QAAQ,CAAC,GAAY;IAC1B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,CAAC,GAAG,GAA4B,CAAC;IACvC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAkB,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC5C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IACrE,IAAI,KAAK,GAAG,eAAe,EAAE,CAAC;QAC1B,MAAM,IAAI,eAAe,CAAC,gBAAgB,KAAK,mBAAmB,eAAe,oDAAoD,CAAC,CAAC;IAC3I,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hug types — the request an agent opens, and the events its requester receives (PLAN-hug-requests §5–§6, §10;
|
|
3
|
+
* PLAN-hug-widgets §3).
|
|
4
|
+
*
|
|
5
|
+
* A Hug is opened with a hug — a named frontend and its definition. The envelope says which hug (`hug: { name }`;
|
|
6
|
+
* cliqd adds the bundle's `sha256`), the title, the keys answers may upload files under (`files`) and the run files
|
|
7
|
+
* the frontend may read (`attachments`); `params` are the hug's input. Core stores and routes the Hug and never
|
|
8
|
+
* interprets `params` or `values`: the hug's definition checks them, in the frontend and in the agent (`ctx.ask`).
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export { ContextBlockSchema, MAX_CONTEXT_BYTES } from './context.js';
|
|
12
|
+
export type { ContextBlock } from './context.js';
|
|
13
|
+
/** Largest serialized `params` (PLAN-hug-widgets §3.1). */
|
|
14
|
+
export declare const MAX_PARAMS_BYTES: number;
|
|
15
|
+
/** Longest Hug summary (plain text shown where the frontend can't be: notifications, the inbox). */
|
|
16
|
+
export declare const MAX_HUG_SUMMARY_LENGTH = 2000;
|
|
17
|
+
/** Most upload slots a Hug may carry. */
|
|
18
|
+
export declare const MAX_FILE_SLOTS = 50;
|
|
19
|
+
/** Most attachments a Hug may carry. */
|
|
20
|
+
export declare const MAX_ATTACHMENTS = 100;
|
|
21
|
+
/** Shortest Hug, in minutes. */
|
|
22
|
+
export declare const MIN_HUG_MINUTES = 1;
|
|
23
|
+
/** Longest Hug, in minutes (7 days). */
|
|
24
|
+
export declare const MAX_HUG_MINUTES = 10080;
|
|
25
|
+
/** Default Hug length when neither the agent nor the phase's `hug:` block sets one (24h). */
|
|
26
|
+
export declare const DEFAULT_HUG_MINUTES = 1440;
|
|
27
|
+
/** Shortest repeat interval for reminders, in minutes. */
|
|
28
|
+
export declare const MIN_REMIND_EVERY_MINUTES = 5;
|
|
29
|
+
/** Largest serialized state an agent may keep with a Hug (PLAN-hug-requests §16); keep big data in files. */
|
|
30
|
+
export declare const MAX_STATE_BYTES: number;
|
|
31
|
+
/** When Core reminds people who haven't responded (set once, at open). */
|
|
32
|
+
export declare const HugRemindersSchema: z.ZodObject<{
|
|
33
|
+
every_min: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
at_min: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
/** When Core reminds people who haven't responded (set once, at open). */
|
|
37
|
+
export type HugReminders = z.infer<typeof HugRemindersSchema>;
|
|
38
|
+
/** An upload slot: a key answers may carry uploaded files under, with what it accepts. */
|
|
39
|
+
export declare const FileSlotSchema: z.ZodObject<{
|
|
40
|
+
name: z.ZodString;
|
|
41
|
+
accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
max_bytes: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
/** A run file the frontend may read: a file reference with its metadata. */
|
|
47
|
+
export declare const AttachmentSchema: z.ZodObject<{
|
|
48
|
+
artifact_id: z.ZodString;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
size: z.ZodNumber;
|
|
51
|
+
content_type: z.ZodString;
|
|
52
|
+
sha256: z.ZodString;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
/** A run file the frontend may read. */
|
|
55
|
+
export type Attachment = z.infer<typeof AttachmentSchema>;
|
|
56
|
+
/**
|
|
57
|
+
* What an agent opens (PLAN-hug-widgets §3.1). `channels`, `expires_in_min` and `reminders` are optional: the SDK
|
|
58
|
+
* fills them from the phase's `hug:` block, then its own defaults. `params` are the hug's: the protocol never reads
|
|
59
|
+
* them (the definition checks them before anything is sent).
|
|
60
|
+
*/
|
|
61
|
+
export declare const HugSpecSchema: z.ZodObject<{
|
|
62
|
+
hug: z.ZodObject<{
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
title: z.ZodString;
|
|
66
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
67
|
+
params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
68
|
+
files: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
|
+
max_bytes: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$strict>>>;
|
|
75
|
+
attachments: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
76
|
+
artifact_id: z.ZodString;
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
size: z.ZodNumber;
|
|
79
|
+
content_type: z.ZodString;
|
|
80
|
+
sha256: z.ZodString;
|
|
81
|
+
}, z.core.$strict>>>;
|
|
82
|
+
channels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
expires_in_min: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
reminders: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
every_min: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
at_min: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
87
|
+
}, z.core.$strict>>;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
/** What an agent opens. */
|
|
90
|
+
export type HugSpec = z.input<typeof HugSpecSchema>;
|
|
91
|
+
/** A spec as checked (defaults filled). */
|
|
92
|
+
export type CheckedHugSpec = z.output<typeof HugSpecSchema>;
|
|
93
|
+
/** Where a Hug is in its life. */
|
|
94
|
+
export type HugStatus = 'open' | 'closed' | 'expired' | 'cancelled';
|
|
95
|
+
/** Who responded. */
|
|
96
|
+
export interface HugResponder {
|
|
97
|
+
readonly user_id: string;
|
|
98
|
+
readonly name: string;
|
|
99
|
+
}
|
|
100
|
+
/** One responder's submission (latest wins if they resubmit). */
|
|
101
|
+
export interface HugResponse {
|
|
102
|
+
readonly response_id: string;
|
|
103
|
+
readonly responder: HugResponder;
|
|
104
|
+
/** The Hug's channels that reached this responder. */
|
|
105
|
+
readonly via: readonly string[];
|
|
106
|
+
/** The answer, as the hug's keys. Checked by the SDK against the definition before a policy sees it. */
|
|
107
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
108
|
+
/** The answer in one line, written by the frontend ("Approved"); absent when it gave none. */
|
|
109
|
+
readonly summary?: string;
|
|
110
|
+
/** ISO timestamp. */
|
|
111
|
+
readonly responded_at: string;
|
|
112
|
+
}
|
|
113
|
+
/** What the requester receives, in `seq` order per Hug. Reminders are never delivered. */
|
|
114
|
+
export type HugEvent = {
|
|
115
|
+
readonly hug_id: string;
|
|
116
|
+
readonly seq: number;
|
|
117
|
+
readonly type: 'response';
|
|
118
|
+
readonly response: HugResponse;
|
|
119
|
+
} | {
|
|
120
|
+
readonly hug_id: string;
|
|
121
|
+
readonly seq: number;
|
|
122
|
+
readonly type: 'expired';
|
|
123
|
+
} | {
|
|
124
|
+
readonly hug_id: string;
|
|
125
|
+
readonly seq: number;
|
|
126
|
+
readonly type: 'cancelled';
|
|
127
|
+
readonly reason?: string;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* One Hug in an invoke's `resume.hugs` (PLAN-hug-requests §8.5): cliqd re-invokes a phase that
|
|
131
|
+
* waits on Hugs with each one's saved requester state and the events it hasn't processed.
|
|
132
|
+
*/
|
|
133
|
+
export interface HugResumeEntry {
|
|
134
|
+
readonly hug_id: string;
|
|
135
|
+
readonly status: HugStatus;
|
|
136
|
+
/** What the SDK saved with `save_state` (opaque to cliqd). */
|
|
137
|
+
readonly state: unknown;
|
|
138
|
+
readonly processed_seq: number;
|
|
139
|
+
readonly events: readonly HugEvent[];
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hug/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,QAAa,CAAC;AAC3C,oGAAoG;AACpG,eAAO,MAAM,sBAAsB,OAAQ,CAAC;AAC5C,yCAAyC;AACzC,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,wCAAwC;AACxC,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC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
/**
|
|
2
|
+
* Hug types — the request an agent opens, and the events its requester receives (PLAN-hug-requests §5–§6, §10;
|
|
3
|
+
* PLAN-hug-widgets §3).
|
|
4
|
+
*
|
|
5
|
+
* A Hug is opened with a hug — a named frontend and its definition. The envelope says which hug (`hug: { name }`;
|
|
6
|
+
* cliqd adds the bundle's `sha256`), the title, the keys answers may upload files under (`files`) and the run files
|
|
7
|
+
* the frontend may read (`attachments`); `params` are the hug's input. Core stores and routes the Hug and never
|
|
8
|
+
* interprets `params` or `values`: the hug's definition checks them, in the frontend and in the agent (`ctx.ask`).
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { HUG_NAME_RE } from './define.js';
|
|
12
|
+
export { ContextBlockSchema, MAX_CONTEXT_BYTES } from './context.js';
|
|
13
|
+
/** Largest serialized `params` (PLAN-hug-widgets §3.1). */
|
|
14
|
+
export const MAX_PARAMS_BYTES = 256 * 1024;
|
|
15
|
+
/** Longest Hug summary (plain text shown where the frontend can't be: notifications, the inbox). */
|
|
16
|
+
export const MAX_HUG_SUMMARY_LENGTH = 2_000;
|
|
17
|
+
/** Most upload slots a Hug may carry. */
|
|
18
|
+
export const MAX_FILE_SLOTS = 50;
|
|
19
|
+
/** Most attachments a Hug may carry. */
|
|
20
|
+
export const MAX_ATTACHMENTS = 100;
|
|
21
|
+
/** Shortest Hug, in minutes. */
|
|
22
|
+
export const MIN_HUG_MINUTES = 1;
|
|
23
|
+
/** Longest Hug, in minutes (7 days). */
|
|
24
|
+
export const MAX_HUG_MINUTES = 10_080;
|
|
25
|
+
/** Default Hug length when neither the agent nor the phase's `hug:` block sets one (24h). */
|
|
26
|
+
export const DEFAULT_HUG_MINUTES = 1_440;
|
|
27
|
+
/** Shortest repeat interval for reminders, in minutes. */
|
|
28
|
+
export const MIN_REMIND_EVERY_MINUTES = 5;
|
|
29
|
+
/** Largest serialized state an agent may keep with a Hug (PLAN-hug-requests §16); keep big data in files. */
|
|
30
|
+
export const MAX_STATE_BYTES = 64 * 1024;
|
|
31
|
+
/** When Core reminds people who haven't responded (set once, at open). */
|
|
32
|
+
export const HugRemindersSchema = z.strictObject({
|
|
33
|
+
/** Repeat while the Hug is open. */
|
|
34
|
+
every_min: z.number().min(MIN_REMIND_EVERY_MINUTES).max(MAX_HUG_MINUTES).optional(),
|
|
35
|
+
/** One-off nudges, minutes after opening. */
|
|
36
|
+
at_min: z.array(z.number().min(MIN_HUG_MINUTES).max(MAX_HUG_MINUTES)).max(10).optional(),
|
|
37
|
+
});
|
|
38
|
+
/** An upload slot: a key answers may carry uploaded files under, with what it accepts. */
|
|
39
|
+
export const FileSlotSchema = z.strictObject({
|
|
40
|
+
name: z.string().min(1).max(64),
|
|
41
|
+
accept: z.array(z.string().min(1).max(100)).max(50).optional(),
|
|
42
|
+
max_bytes: z.number().int().min(1).optional(),
|
|
43
|
+
multiple: z.boolean().optional(),
|
|
44
|
+
required: z.boolean().optional(),
|
|
45
|
+
});
|
|
46
|
+
/** A run file the frontend may read: a file reference with its metadata. */
|
|
47
|
+
export const AttachmentSchema = z.strictObject({
|
|
48
|
+
artifact_id: z.string().min(1),
|
|
49
|
+
name: z.string().min(1).max(500),
|
|
50
|
+
size: z.number().int().min(0),
|
|
51
|
+
content_type: z.string().min(1).max(200),
|
|
52
|
+
sha256: z.string().max(64),
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* What an agent opens (PLAN-hug-widgets §3.1). `channels`, `expires_in_min` and `reminders` are optional: the SDK
|
|
56
|
+
* fills them from the phase's `hug:` block, then its own defaults. `params` are the hug's: the protocol never reads
|
|
57
|
+
* them (the definition checks them before anything is sent).
|
|
58
|
+
*/
|
|
59
|
+
export const HugSpecSchema = z.strictObject({
|
|
60
|
+
/** Which hug, by name; cliqd resolves it and adds the bundle's `sha256`. */
|
|
61
|
+
hug: z.strictObject({ name: z.string().regex(HUG_NAME_RE, 'must be lowercase letters, digits and -') }),
|
|
62
|
+
/** Shown in the Hub's chrome, notifications, reminders and the inbox. */
|
|
63
|
+
title: z.string().min(1).max(200),
|
|
64
|
+
/** Plain text where the frontend can't be (notifications, the inbox, Slack and email). */
|
|
65
|
+
summary: z.string().max(MAX_HUG_SUMMARY_LENGTH).optional(),
|
|
66
|
+
params: z.record(z.string(), z.unknown()).default({}).refine((p) => Buffer.byteLength(JSON.stringify(p), 'utf8') <= MAX_PARAMS_BYTES, `params is larger than ${MAX_PARAMS_BYTES / 1024} KB — attach files instead`),
|
|
67
|
+
/** The keys answers may upload files under (from the definition's file fields). */
|
|
68
|
+
files: z.array(FileSlotSchema).max(MAX_FILE_SLOTS).default([]),
|
|
69
|
+
/** Run files the frontend may read (`ctx.attach`). */
|
|
70
|
+
attachments: z.array(AttachmentSchema).max(MAX_ATTACHMENTS).default([]),
|
|
71
|
+
channels: z.array(z.string().min(1)).optional(),
|
|
72
|
+
expires_in_min: z.number().min(MIN_HUG_MINUTES).max(MAX_HUG_MINUTES).optional(),
|
|
73
|
+
reminders: HugRemindersSchema.optional(),
|
|
74
|
+
}).superRefine((spec, ctx) => {
|
|
75
|
+
const names = spec.files.map((f) => f.name);
|
|
76
|
+
const dup = names.find((n, i) => names.indexOf(n) !== i);
|
|
77
|
+
if (dup)
|
|
78
|
+
ctx.addIssue({ code: 'custom', message: `the upload slot '${dup}' is listed twice`, path: ['files'] });
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/hug/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGrE,2DAA2D;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3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C,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzD,IAAI,GAAG;QAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,GAAG,mBAAmB,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AACpH,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @getcliqio/cliq-sdk — SDK for building Cliq pipeline agents.
|
|
3
|
+
*
|
|
4
|
+
* Agents receive an AgentMessage on stdin (JSON) and route to handlers
|
|
5
|
+
* declared in a `handlers` map keyed by capability string. Helper
|
|
6
|
+
* functions handle .cliq/ filesystem protocol: context assembly,
|
|
7
|
+
* handoff writing, signal writing, and task board persistence.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
*
|
|
11
|
+
* new CliqAgent({
|
|
12
|
+
* name: 'my-agent',
|
|
13
|
+
* handlers: {
|
|
14
|
+
* 'phase:standard': async (msg) => {
|
|
15
|
+
* const ctx = build_phase_context(msg, 'my-agent');
|
|
16
|
+
* ctx.send('reviewer', 'Implementation notes...');
|
|
17
|
+
* finalize_standard_phase(ctx, msg);
|
|
18
|
+
* },
|
|
19
|
+
* },
|
|
20
|
+
* }).run();
|
|
21
|
+
*/
|
|
22
|
+
export { PROTOCOL_VERSION, MESSAGE_TYPES, Message, MessageType, Payloads, NdjsonCodec, NdjsonDecoder, } from './protocol/index.js';
|
|
23
|
+
export type * from './protocol/types/foundations.js';
|
|
24
|
+
export type * from './protocol/types/workspace.js';
|
|
25
|
+
export type * from './protocol/types/team.js';
|
|
26
|
+
export type * from './protocol/types/agent.js';
|
|
27
|
+
export type * from './protocol/types/pipeline.js';
|
|
28
|
+
export type * from './protocol/types/cliq_core.js';
|
|
29
|
+
export { Connection, TcpServer, connect } from './tcp/index.js';
|
|
30
|
+
export type { ConnectionOptions, OutboundValidation, ConnectOptions, ServerOptions, PendingRequest, } from './tcp/index.js';
|
|
31
|
+
export { create_agent } from './agent_api.js';
|
|
32
|
+
export type { AgentConfig, AgentContext, RunningAgent as RunningAgentLegacy } from './agent_api.js';
|
|
33
|
+
export { BaseAgent, StandardAgent, GateAgent, LlmAgent, CliAgent, ConnectorAgent, turn_from_text, turn_from_cli_stdout, build_cli_turn_prompt, extract_question, answers_from_resume, normalize_event_artifacts, artifacts_from_event_payload, is_event_artifact_ref, is_event_artifact_inline, } from './agents/index.js';
|
|
34
|
+
export type { BaseContext, StandardContext, LlmContext, CliContext, ConnectorContext, AgentOutput, AgentLogger, AgentStartOptions, EventPoster, AgentDaemonTransport, LlmAgentOptions, CliAgentOptions, CliResult, Source, Target, AgentCheckpoint, TurnResult, ChatMessage, CliPromptParts, EventArtifact, EventArtifactRef, EventArtifactInline, } from './agents/index.js';
|
|
35
|
+
export type { GateContext as TcpGateContext } from './agents/index.js';
|
|
36
|
+
export type { BaseAgentPayload, LlmAgentPayload, ExecAgentPayload, ConnectorAgentPayload, PayloadFieldSpec, } from './agent_payloads.js';
|
|
37
|
+
export { is_llm_payload, PAYLOAD_SCHEMAS } from './agent_payloads.js';
|
|
38
|
+
export { DAEMON_SETTING_PREFIXES, DAEMON_SETTING_EXACT_KEYS, is_daemon_setting_key, } from './settings_keys.js';
|
|
39
|
+
export { LIFECYCLE_EVENTS, DEFAULT_NOTIFY_EVENTS, AGENT_STREAM_EVENTS, is_lifecycle_event, is_default_notify_event, is_custom_event, } from './events/catalog.js';
|
|
40
|
+
export type { LifecycleEvent, DefaultNotifyEvent, AgentStreamEvent, } from './events/catalog.js';
|
|
41
|
+
export { HttpDaemonClient, DaemonUnreachableError, DAEMON_ROUTES } from './http_daemon_client.js';
|
|
42
|
+
export type { HttpDaemonClientOptions, CallOptions, DaemonCallTarget, DaemonRouteName } from './http_daemon_client.js';
|
|
43
|
+
export { DaemonError, read_daemon_reply, post_daemon } from './daemon_wire.js';
|
|
44
|
+
export type { PostDaemonOptions, DaemonErrorBody, DaemonReply, RunStarted, RunInputsRequired, RunAgentNotReady, RunOutcome, InitOutcome, InitInputField, } from './daemon_wire.js';
|
|
45
|
+
export { LOG_LEVELS, get_logger, configure_logging, attach_tcp_sink, attach_sink, attach_execution_sink, emit_execution_log, emit_execution_event, emit_execution_artifact, shutdown_logging, } from './logging.js';
|
|
46
|
+
export type { LogLevel, LogPayload, LogData, CanonicalFields, CanonicalLogger, LoggingConfig, FileAppenderConfig, ExecutionEntryKind, } from './logging.js';
|
|
47
|
+
export { USAGE_RECORD_VERSION, AGENT_KINDS, UNIT_KINDS, OUTCOMES, usage_record_schema, usage_record_partial_schema, usage_to_span_attrs, span_attrs_to_usage, roll_up_usage, rollup_to_span_attrs, synthesize_baseline_usage, merge_usage, report_usage, UsageValidationError, } from './telemetry/usage.js';
|
|
48
|
+
export type { AgentKind, UnitKind, Outcome, UsageRecord, UsageRecordPartial, UsageRollup, UsageRollupTotals, UsageRollupByUnit, BaselineInputs, ReportUsageOptions, } from './telemetry/usage.js';
|
|
49
|
+
export { extract_usage_from_event, extract_usage_from_events, extract_usage_from_ndjson, } from './telemetry/stream_json_usage.js';
|
|
50
|
+
/** A repository entry in a multi-repo workspace. */
|
|
51
|
+
export interface WorkspaceRepo {
|
|
52
|
+
path: string;
|
|
53
|
+
url?: string;
|
|
54
|
+
default_branch?: string;
|
|
55
|
+
}
|
|
56
|
+
export type { AgentManifest, AgentSettingEntry, SchemaField, SchemaFieldType } from './agent_manifest.js';
|
|
57
|
+
export { validate_manifest, read_manifest, resolve_entry } from './agent_manifest.js';
|
|
58
|
+
export type { McpManifest, McpPreset, McpSecretSpec, McpServerConfig, McpTransport, McpParseResult, McpResolved } from './mcp.js';
|
|
59
|
+
export { MCP_SERVERS_KEY, MCP_SECRET_PREFIX, mcp_placeholders, mcp_secrets_from_settings, mcp_servers_setting, mcp_transport_of, parse_mcp_servers, resolve_mcp_servers, validate_mcp_manifest, validate_mcp_server, } from './mcp.js';
|
|
60
|
+
export type { McpCallResult, McpLog, McpTool, McpToolDef } from './mcp_client.js';
|
|
61
|
+
export { McpClient, McpToolbox, MCP_PROTOCOL_VERSION, mcp_result_text, mcp_servers_for_run, mcp_tool_name, open_mcp_toolbox } from './mcp_client.js';
|
|
62
|
+
export * as CliqPaths from './paths.js';
|
|
63
|
+
export { CoreApiClient, CoreApiError } from './core_api_client.js';
|
|
64
|
+
export type { CoreApiClientOptions } from './core_api_client.js';
|
|
65
|
+
export { Redact } from './utils/redact.js';
|
|
66
|
+
export { parse_duration_minutes } from './utils/duration.js';
|
|
67
|
+
export * from './hug/index.js';
|
|
68
|
+
export * from './builtin_teams/index.js';
|
|
69
|
+
export { lint_team, PHASE_FIELDS, TEAM_INPUT_FIELDS } from './team_lint.js';
|
|
70
|
+
export type { AgentInputDef, AgentInputs, TeamInputDef, TeamProblem } from './team_lint.js';
|
|
71
|
+
export * from './team/index.js';
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|