@intx/hub-sessions 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/dist/agent-repo.d.ts +9 -5
- package/dist/agent-repo.js +2 -2
- package/dist/agent-state-kind.js +4 -0
- package/dist/asset-service.d.ts +1 -20
- package/dist/asset-service.js +9 -91
- package/dist/committed-source-tree.d.ts +10 -0
- package/dist/committed-source-tree.js +35 -0
- package/dist/credential-push.d.ts +7 -6
- package/dist/credential-push.js +42 -18
- package/dist/event-collector-registry.d.ts +1 -1
- package/dist/event-collector-registry.js +4 -4
- package/dist/event-collector.d.ts +1 -1
- package/dist/event-collector.js +10 -2
- package/dist/hub-session-lookups.d.ts +125 -7
- package/dist/hub-session-lookups.js +539 -80
- package/dist/hub-session-orchestrator.js +14 -49
- package/dist/index.d.ts +17 -8
- package/dist/index.js +14 -6
- package/dist/repo-store/index.d.ts +1 -1
- package/dist/repo-store/store.d.ts +1 -1
- package/dist/repo-store/store.js +138 -1
- package/dist/repo-store/subscribe-kind.d.ts +6 -3
- package/dist/repo-store/subscribe-kind.js +42 -77
- package/dist/repo-store/types.d.ts +94 -6
- package/dist/session-service.d.ts +277 -96
- package/dist/session-service.js +741 -547
- package/dist/sidecar-allocation/contracts.d.ts +78 -0
- package/dist/sidecar-allocation/contracts.js +21 -0
- package/dist/sidecar-allocation/index.d.ts +4 -0
- package/dist/sidecar-allocation/index.js +3 -0
- package/dist/sidecar-allocation/placement-policy.d.ts +11 -0
- package/dist/sidecar-allocation/placement-policy.js +21 -0
- package/dist/sidecar-allocation/plugin-registry.d.ts +11 -0
- package/dist/sidecar-allocation/plugin-registry.js +37 -0
- package/dist/sidecar-allocation/reconciler.d.ts +42 -0
- package/dist/sidecar-allocation/reconciler.js +431 -0
- package/dist/skill-kind.js +4 -0
- package/dist/substrate.d.ts +3 -3
- package/dist/substrate.js +1 -1
- package/dist/workflow-allocation-service.d.ts +58 -0
- package/dist/workflow-allocation-service.js +239 -0
- package/dist/workflow-closure-resolution.d.ts +106 -0
- package/dist/workflow-closure-resolution.js +123 -0
- package/dist/workflow-definition-ensure.d.ts +24 -0
- package/dist/workflow-definition-ensure.js +75 -0
- package/dist/workflow-dispatch-service.d.ts +40 -0
- package/dist/workflow-dispatch-service.js +146 -0
- package/dist/workflow-dispatch-settlement.d.ts +29 -0
- package/dist/workflow-dispatch-settlement.js +140 -0
- package/dist/workflow-kind.d.ts +17 -1
- package/dist/workflow-kind.js +127 -80
- package/dist/workflow-probe-gate.d.ts +214 -0
- package/dist/workflow-probe-gate.js +207 -0
- package/dist/workflow-run-kind.d.ts +128 -14
- package/dist/workflow-run-kind.js +353 -83
- package/dist/workflow-run-reader.d.ts +1 -1
- package/dist/workflow-run-reader.js +3 -7
- package/dist/workflow-run-restore.d.ts +15 -0
- package/dist/workflow-run-restore.js +26 -0
- package/dist/workflow-source-closure.d.ts +35 -0
- package/dist/workflow-source-closure.js +342 -0
- package/dist/ws/index.d.ts +3 -3
- package/dist/ws/index.js +1 -1
- package/dist/ws/sidecar-events.d.ts +100 -12
- package/dist/ws/sidecar-events.js +2 -0
- package/dist/ws/sidecar-handler.d.ts +128 -7
- package/dist/ws/sidecar-handler.js +1069 -135
- package/dist/ws/sidecar-token-authenticator.d.ts +3 -1
- package/dist/ws/sidecar-token-authenticator.js +64 -7
- package/package.json +14 -13
- package/dist/available-skills-stanza.d.ts +0 -21
- package/dist/available-skills-stanza.js +0 -32
|
@@ -5,13 +5,131 @@ export type HubSessionLookupsDeps = {
|
|
|
5
5
|
db: DB["db"];
|
|
6
6
|
agentRepoStore: AgentRepoStore;
|
|
7
7
|
};
|
|
8
|
-
export declare function createHubSessionLookups(deps: HubSessionLookupsDeps): Required<SidecarLookups
|
|
8
|
+
export declare function createHubSessionLookups(deps: HubSessionLookupsDeps): Required<Omit<SidecarLookups, "materializeMailTriggeredRunGrants">>;
|
|
9
9
|
/**
|
|
10
|
-
* Extract the
|
|
11
|
-
* Throws on any input the `@intx/types`-owned `
|
|
12
|
-
* rejects: missing or leading `@`, empty domain, or
|
|
13
|
-
* without the canonical `
|
|
10
|
+
* Extract the run id from an `<runId>@<domain>` run address.
|
|
11
|
+
* Throws on any input the `@intx/types`-owned `parseRunAddress`
|
|
12
|
+
* rejects: missing or leading `@`, empty domain, or a run id
|
|
13
|
+
* without the canonical `run_` prefix.
|
|
14
14
|
*/
|
|
15
15
|
export declare function parseAgentId(agentAddress: string): string;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A live routing endpoint backing a run address. Each address names one
|
|
18
|
+
* self-anchored `workflow_run`, so the endpoint is always that run.
|
|
19
|
+
*/
|
|
20
|
+
export interface RoutableEndpoint {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly tenantId: string;
|
|
23
|
+
readonly address: string;
|
|
24
|
+
readonly publicKey: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* The endpoint's raw run status. Resolution is `endedAt`-filtered, so a
|
|
27
|
+
* resolved endpoint is not necessarily live: a leaked run is deliberately
|
|
28
|
+
* kept routable (terminal status, null `endedAt`) to stay reachable, and the
|
|
29
|
+
* reconnect reaction reads this to keep such an endpoint routable without
|
|
30
|
+
* restoring a collector.
|
|
31
|
+
*/
|
|
32
|
+
readonly status: string;
|
|
33
|
+
/**
|
|
34
|
+
* The live session backing this endpoint. A folded run has no session column,
|
|
35
|
+
* so this is the run's not-yet-ended `agent_session`, keyed by the run's
|
|
36
|
+
* principal. Transitional -- it retires when mail record-keeping moves off
|
|
37
|
+
* `agent_session`.
|
|
38
|
+
*/
|
|
39
|
+
readonly sessionId: string | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve a run address to the `workflow_run` endpoint backing it, keyed by
|
|
43
|
+
* the run's `address`. Every routable address names one self-anchored run --
|
|
44
|
+
* the deployment's anchor -- so this resolves the run's own address (the
|
|
45
|
+
* source `persistMail` depends on to record a triggered deployment's mail).
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveRoutableAddress(db: DB["db"], address: string): Promise<RoutableEndpoint | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* A folded run has no session column; its session is the `agent_session` keyed
|
|
50
|
+
* by the run's principal. By default this is the live (not-yet-ended) session,
|
|
51
|
+
* matching routing semantics; `includeEnded` also resolves a stopped run's
|
|
52
|
+
* ended session, which mail history needs. Returns null when the run has no
|
|
53
|
+
* principal or no matching session. Transitional, alongside
|
|
54
|
+
* `RoutableEndpoint.sessionId`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveRunSessionId(db: DB["db"], principalId: string | null, opts?: {
|
|
57
|
+
includeEnded?: boolean;
|
|
58
|
+
}): Promise<string | null>;
|
|
59
|
+
/**
|
|
60
|
+
* The folded run that owns a session, or null when the session belongs to no
|
|
61
|
+
* run. This is the inverse of `resolveRunSessionId`: a mail-read path holds a
|
|
62
|
+
* `sessionMail.sessionId` and no address, so it recovers the owning run by
|
|
63
|
+
* joining `workflow_run` to `agent_session` on their shared principal (a folded
|
|
64
|
+
* run, its session, and its launch all key on the same `instancePrincipalId`).
|
|
65
|
+
* Scoped to the tenant and routed through `workflow_run` so the returned id is
|
|
66
|
+
* proven to name a real run of this tenant -- callers key an authorization
|
|
67
|
+
* subject on it, so a session held by a non-run principal must fail closed to
|
|
68
|
+
* null rather than resolve to a fabricated subject.
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolveRunIdForSession(db: DB["db"], sessionId: string, tenantId: string): Promise<string | null>;
|
|
71
|
+
/**
|
|
72
|
+
* A folded run resolved BY ID for the instance read/interact surface, shaped
|
|
73
|
+
* into one instance-shaped record. Unlike `resolveRoutableAddress` (keyed by
|
|
74
|
+
* address, live-only), this is keyed by the path id and does NOT filter
|
|
75
|
+
* terminated rows -- a stopped run's detail, mail history, and turns are still
|
|
76
|
+
* served. Keep the two separate: routing must never reach a dead endpoint,
|
|
77
|
+
* while the read surface must still render one.
|
|
78
|
+
*/
|
|
79
|
+
export interface RoutableRecord {
|
|
80
|
+
readonly id: string;
|
|
81
|
+
readonly tenantId: string;
|
|
82
|
+
/** The routing address. Non-null: a run resolves here only when it owns an
|
|
83
|
+
* address. */
|
|
84
|
+
readonly address: string;
|
|
85
|
+
readonly publicKey: string | null;
|
|
86
|
+
/** Raw run status. The wire mapping onto the instance status enum is a
|
|
87
|
+
* hub-api concern, done by the response shaper. */
|
|
88
|
+
readonly status: string;
|
|
89
|
+
readonly createdAt: Date;
|
|
90
|
+
/** A run has no `updatedAt` column, so it reports `endedAt ?? createdAt`. */
|
|
91
|
+
readonly updatedAt: Date;
|
|
92
|
+
readonly endedAt: Date | null;
|
|
93
|
+
/** The folded definition this run belongs to (`workflow_definition.id`). */
|
|
94
|
+
readonly definitionId: string;
|
|
95
|
+
readonly principalId: string | null;
|
|
96
|
+
readonly kernelId: string | null;
|
|
97
|
+
readonly sidecarId: string | null;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Shape a run row and its already-resolved routing address into the run
|
|
101
|
+
* record. Callers decide whether the run resolves at all -- only a top-level
|
|
102
|
+
* run (`isTopLevelRun`) does -- and pass the address they have narrowed; this
|
|
103
|
+
* only maps the columns, including the run's `endedAt ?? createdAt` stand-in
|
|
104
|
+
* for the absent `updatedAt`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function runRowToRoutableRecord(run: {
|
|
107
|
+
id: string;
|
|
108
|
+
tenantId: string;
|
|
109
|
+
publicKey: string | null;
|
|
110
|
+
status: string;
|
|
111
|
+
createdAt: Date;
|
|
112
|
+
endedAt: Date | null;
|
|
113
|
+
definitionId: string;
|
|
114
|
+
principalId: string | null;
|
|
115
|
+
kernelId: string | null;
|
|
116
|
+
sidecarId: string | null;
|
|
117
|
+
}, address: string): RoutableRecord;
|
|
118
|
+
/**
|
|
119
|
+
* A run is a top-level run -- the addressable head of a deployment -- when it
|
|
120
|
+
* owns a routing address AND self-anchors (`anchorRunId === id`). A lazy child
|
|
121
|
+
* park row anchors on its parent (`anchorRunId !== id`) and carries no address;
|
|
122
|
+
* either condition excludes it. This is the single predicate the run read
|
|
123
|
+
* surface classifies on, so the resolver and the run list cannot drift.
|
|
124
|
+
*/
|
|
125
|
+
export declare function isTopLevelRun(row: {
|
|
126
|
+
id: string;
|
|
127
|
+
address: string | null;
|
|
128
|
+
anchorRunId: string | null;
|
|
129
|
+
}): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Resolve a run id to its record. A run resolves only when it is a top-level
|
|
132
|
+
* run (`isTopLevelRun`): it owns a routing address and self-anchors. A child
|
|
133
|
+
* park row (address-null, anchored on its parent) is not served here.
|
|
134
|
+
*/
|
|
135
|
+
export declare function findRoutableById(db: DB["db"], id: string, tenantId: string): Promise<RoutableRecord | undefined>;
|