supertag-ai 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -0
  3. package/dist/chunk-B3EVEGNZ.js +13 -0
  4. package/dist/chunk-B3EVEGNZ.js.map +1 -0
  5. package/dist/chunk-ES42FTPC.js +1068 -0
  6. package/dist/chunk-ES42FTPC.js.map +1 -0
  7. package/dist/chunk-L7S2TKUG.js +656 -0
  8. package/dist/chunk-L7S2TKUG.js.map +1 -0
  9. package/dist/connectors.d.ts +45 -0
  10. package/dist/connectors.js +39 -0
  11. package/dist/connectors.js.map +1 -0
  12. package/dist/core.d.ts +721 -0
  13. package/dist/core.js +3 -0
  14. package/dist/core.js.map +1 -0
  15. package/dist/environments/e2b.d.ts +69 -0
  16. package/dist/environments/e2b.js +268 -0
  17. package/dist/environments/e2b.js.map +1 -0
  18. package/dist/gateway.d.ts +59 -0
  19. package/dist/gateway.js +1215 -0
  20. package/dist/gateway.js.map +1 -0
  21. package/dist/harnesses/claude-code.d.ts +67 -0
  22. package/dist/harnesses/claude-code.js +565 -0
  23. package/dist/harnesses/claude-code.js.map +1 -0
  24. package/dist/harnesses/codex.d.ts +68 -0
  25. package/dist/harnesses/codex.js +690 -0
  26. package/dist/harnesses/codex.js.map +1 -0
  27. package/dist/index.d.ts +100 -0
  28. package/dist/index.js +4 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/resources/github.d.ts +80 -0
  31. package/dist/resources/github.js +374 -0
  32. package/dist/resources/github.js.map +1 -0
  33. package/dist/resources/linear.d.ts +25 -0
  34. package/dist/resources/linear.js +92 -0
  35. package/dist/resources/linear.js.map +1 -0
  36. package/dist/resources/slack.d.ts +25 -0
  37. package/dist/resources/slack.js +98 -0
  38. package/dist/resources/slack.js.map +1 -0
  39. package/dist/resources/teams.d.ts +27 -0
  40. package/dist/resources/teams.js +101 -0
  41. package/dist/resources/teams.js.map +1 -0
  42. package/dist/transport.d.ts +5 -0
  43. package/dist/transport.js +3 -0
  44. package/dist/transport.js.map +1 -0
  45. package/dist/worker.d.ts +634 -0
  46. package/dist/worker.js +3 -0
  47. package/dist/worker.js.map +1 -0
  48. package/package.json +127 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SuperTag contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # supertag-ai
2
+
3
+ Build custom Workers, Harnesses, execution environments, Connectors, and Worker resources for [SuperTag](https://github.com/bfloat-inc/supertag).
4
+
5
+ ```sh
6
+ npm install supertag-ai
7
+ ```
8
+
9
+ The main entry point contains the Worker runtime and the persistent Gateway transport:
10
+
11
+ ```ts
12
+ import {
13
+ LocalProcessEnvironmentProvider,
14
+ LocalWorkerHost,
15
+ WorkerRuntime,
16
+ connectWorkerHost,
17
+ } from "supertag-ai";
18
+ ```
19
+
20
+ Use explicit subpaths for optional implementations and lower-level extension contracts:
21
+
22
+ ```ts
23
+ import { tagIdSchema } from "supertag-ai/core";
24
+ import { type Connector } from "supertag-ai/connectors";
25
+ import { CodexHarness } from "supertag-ai/harnesses/codex";
26
+ import { ClaudeCodeHarness } from "supertag-ai/harnesses/claude-code";
27
+ import { E2BEnvironmentProvider } from "supertag-ai/environments/e2b";
28
+ import { GitHubRepositoryWorkspaceMaterializer } from "supertag-ai/resources/github";
29
+ ```
30
+
31
+ ## Public entry points
32
+
33
+ | Import | Purpose |
34
+ | --- | --- |
35
+ | `supertag-ai` | Worker and Worker Host contracts, local runtime, and Gateway transport |
36
+ | `supertag-ai/core` | Tag, Context Set, Permission Set, Task, Session, and connector-neutral domain contracts |
37
+ | `supertag-ai/worker` | Worker, Harness, environment, materializer, tool, and checkpoint contracts |
38
+ | `supertag-ai/transport` | Persistent remote Worker Host connection and protocol |
39
+ | `supertag-ai/connectors` | Custom collaboration-surface Connector contract and Markdown pipeline |
40
+ | `supertag-ai/gateway` | Embeddable Gateway orchestration contract |
41
+ | `supertag-ai/harnesses/*` | Shipped Codex and Claude Code Harnesses |
42
+ | `supertag-ai/environments/e2b` | Shipped E2B execution environment |
43
+ | `supertag-ai/resources/*` | Permission-derived MCP and workspace integrations |
44
+
45
+ The package supports Node.js 24 or newer and is ESM-only. Optional Harness and remote-environment SDKs are installed as optional dependencies and are loaded only through their explicit subpaths.
46
+
47
+ See the [custom Worker and Harness guide](https://github.com/bfloat-inc/supertag/blob/main/docs/guides/custom-workers.md) for a complete implementation and Gateway connection walkthrough.
48
+
49
+ ## License
50
+
51
+ MIT
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+
3
+ // ../core/src/index.ts
4
+ var tagIdSchema = z.string().trim().min(1).brand();
5
+ function emptyTagContextPlan(capturedAt) {
6
+ return { version: 4, capturedAt, sets: [] };
7
+ }
8
+ var WORK_RECORD_ARTIFACT_KIND = "supertag.work-record.v1";
9
+ var CORE_VERSION = "0.0.0";
10
+
11
+ export { CORE_VERSION, WORK_RECORD_ARTIFACT_KIND, emptyTagContextPlan, tagIdSchema };
12
+ //# sourceMappingURL=chunk-B3EVEGNZ.js.map
13
+ //# sourceMappingURL=chunk-B3EVEGNZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../core/src/index.ts"],"names":[],"mappings":";;;AAEO,IAAM,WAAA,GAAc,EAAE,MAAA,EAAO,CAAE,MAAK,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,KAAA;AA4S7C,SAAS,oBAAoB,UAAA,EAAoC;AACtE,EAAA,OAAO,EAAE,OAAA,EAAS,CAAA,EAAG,UAAA,EAAY,IAAA,EAAM,EAAC,EAAE;AAC5C;AA8LO,IAAM,yBAAA,GAA4B;AAuVlC,IAAM,YAAA,GAAe","file":"chunk-B3EVEGNZ.js","sourcesContent":["import { z } from \"zod\";\n\nexport const tagIdSchema = z.string().trim().min(1).brand<\"TagId\">();\nexport type TagId = z.infer<typeof tagIdSchema>;\n\nexport type DatabaseProvider = \"sqlite\" | \"postgresql\";\n\nexport type ConnectorProvider = \"github\" | \"lark\" | \"linear\" | \"slack\" | \"teams\";\n\n/** Immutable reference to one revision of a Worker execution profile. */\nexport interface WorkerProfileRef {\n readonly id: string;\n readonly revision: string;\n}\n\nexport interface CreateTagInput {\n readonly name: string;\n readonly workerProfile?: WorkerProfileRef;\n}\n\n/** SuperTag's stable non-human IAM principal and policy anchor. */\nexport interface Tag {\n readonly id: string;\n readonly name: string;\n readonly workerProfile: WorkerProfileRef;\n readonly status: \"active\";\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface AddTagPresenceInput {\n readonly tagId: string;\n readonly connectorAccountId: string;\n readonly scope: string;\n readonly enabled?: boolean;\n readonly createdBy?: string;\n}\n\n/**\n * One Tag's durable, unambiguous presence at a connector-account scope.\n * A presence provides only the baseline invocation lifecycle; Context and\n * Permission Set activations independently equip and authorize admitted Tasks.\n */\nexport interface TagPresence {\n readonly id: string;\n readonly tagId: string;\n readonly connectorAccountId: string;\n readonly scope: string;\n readonly enabled: boolean;\n readonly createdBy?: string;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface TagPresenceListFilter {\n readonly tagId?: string;\n readonly connectorAccountId?: string;\n readonly enabled?: boolean;\n}\n\nexport interface CreateTagPermissionSetInput {\n readonly tagId: string;\n readonly name: string;\n readonly createdBy?: string;\n}\n\nexport interface TagPermissionSet {\n readonly id: string;\n readonly tagId: string;\n readonly name: string;\n readonly createdBy?: string;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface TagPermissionSetListFilter {\n readonly tagId?: string;\n}\n\nexport interface AddTagPermissionInput {\n readonly permissionSetId: string;\n readonly connectorAccountId: string;\n readonly scope: string;\n /** Canonical, non-secret resource locator used for request-time target selection. */\n readonly reference?: string;\n readonly action: string;\n readonly createdBy?: string;\n}\n\nexport interface TagPermission {\n readonly id: string;\n readonly permissionSetId: string;\n readonly connectorAccountId: string;\n readonly scope: string;\n readonly reference?: string;\n readonly action: string;\n readonly createdBy?: string;\n readonly createdAt: string;\n}\n\nexport interface TagPermissionListFilter {\n readonly permissionSetId?: string;\n readonly tagId?: string;\n readonly connectorAccountId?: string;\n readonly scope?: string;\n}\n\nexport interface ActivateTagPermissionSetInput {\n readonly permissionSetId: string;\n readonly tagPresenceId: string;\n readonly createdBy?: string;\n}\n\nexport interface TagPermissionActivation {\n readonly id: string;\n readonly permissionSetId: string;\n readonly tagPresenceId: string;\n readonly createdBy?: string;\n readonly createdAt: string;\n}\n\nexport interface TagPermissionActivationListFilter {\n readonly permissionSetId?: string;\n readonly tagPresenceId?: string;\n}\n\nexport interface CreateTagContextSetInput {\n readonly tagId: string;\n readonly name: string;\n readonly createdBy?: string;\n}\n\n/** A Tag-owned, permission-neutral collection of Task-composition items. */\nexport interface TagContextSet {\n readonly id: string;\n readonly tagId: string;\n readonly name: string;\n readonly createdBy?: string;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface TagContextSetListFilter {\n readonly tagId?: string;\n}\n\nexport interface TagSkillConfiguration {\n readonly digest?: string;\n readonly version?: string;\n}\n\nexport interface TagWorkSelectionPolicy {\n readonly match: \"shared-resource\";\n readonly maxAgeDays: number;\n readonly limit: number;\n}\n\ninterface AddTagContextItemBase {\n readonly contextSetId: string;\n /** Stable identity used to make adding an item idempotent. */\n readonly itemKey: string;\n readonly createdBy?: string;\n}\n\nexport type AddTagContextItemInput =\n | (AddTagContextItemBase & {\n readonly kind: \"skill\";\n readonly reference: string;\n readonly configuration?: TagSkillConfiguration;\n })\n | (AddTagContextItemBase & {\n readonly kind: \"work\";\n /** Exact Tag presence from which completed Work Records may be selected. */\n readonly sourcePresenceId: string;\n readonly selection: TagWorkSelectionPolicy;\n });\n\ninterface TagContextItemBase {\n readonly id: string;\n readonly contextSetId: string;\n readonly itemKey: string;\n readonly createdBy?: string;\n readonly createdAt: string;\n}\n\nexport type TagContextItem =\n | (TagContextItemBase & {\n readonly kind: \"skill\";\n readonly reference: string;\n readonly configuration?: TagSkillConfiguration;\n })\n | (TagContextItemBase & {\n readonly kind: \"work\";\n readonly sourcePresenceId: string;\n readonly selection: TagWorkSelectionPolicy;\n });\n\nexport interface TagContextItemListFilter {\n readonly contextSetId?: string;\n}\n\nexport interface ActivateTagContextSetInput {\n readonly contextSetId: string;\n readonly tagPresenceId: string;\n readonly createdBy?: string;\n}\n\n/** Makes one Context Set eligible when the Tag is invoked from one configured location. */\nexport interface TagContextActivation {\n readonly id: string;\n readonly contextSetId: string;\n readonly tagPresenceId: string;\n readonly createdBy?: string;\n readonly createdAt: string;\n}\n\nexport interface TagContextActivationListFilter {\n readonly contextSetId?: string;\n readonly tagPresenceId?: string;\n}\n\n/** Explains whether access comes from the invocation location or an explicit Permission Set. */\nexport type TagAuthorizationSource = \"origin\" | \"permission-set\";\n\nexport interface TagAuthorizationResource {\n readonly connectorAccountId: string;\n readonly provider: ConnectorProvider;\n readonly scope: string;\n /** Canonical, non-secret locator when the Connector can provide one. */\n readonly reference?: string;\n readonly actions: readonly string[];\n readonly sources: readonly TagAuthorizationSource[];\n}\n\n/**\n * Immutable collaboration authorization captured when the Gateway admits a Task.\n * The Worker Host uses the selected profile and this policy to provision the\n * harness, workspace, and MCP environment without routing tool calls through\n * the Gateway.\n */\nexport interface TagAuthorizationSnapshot {\n readonly version: 2;\n readonly capturedAt: string;\n readonly tag: {\n readonly id: string;\n readonly name: string;\n readonly workerProfile: WorkerProfileRef;\n };\n readonly origin: {\n readonly tagPresenceId: string;\n readonly connectorAccountId: string;\n readonly provider: ConnectorProvider;\n readonly scope: string;\n };\n readonly requester: InboundEventActor;\n readonly permissionSets: readonly {\n readonly id: string;\n readonly name: string;\n }[];\n readonly resources: readonly TagAuthorizationResource[];\n}\n\ninterface TagContextPlanItemBase {\n readonly id: string;\n readonly itemKey: string;\n}\n\nexport type TagContextPlanItem =\n | (TagContextPlanItemBase & {\n readonly kind: \"skill\";\n readonly reference: string;\n readonly configuration?: TagSkillConfiguration;\n })\n | (TagContextPlanItemBase & {\n readonly kind: \"work\";\n readonly source: {\n readonly tagPresenceId: string;\n readonly connectorAccountId: string;\n readonly provider: ConnectorProvider;\n readonly scope: string;\n };\n readonly selection: TagWorkSelectionPolicy;\n /** Gateway-resolved, immutable cross-Session work admitted for this Task. */\n readonly workRecords: readonly WorkRecord[];\n });\n\nexport interface TagContextPlanSet {\n readonly id: string;\n readonly name: string;\n readonly items: readonly TagContextPlanItem[];\n}\n\n/**\n * Immutable selection of shared Work Records and skills for a Task.\n * This does not authorize access: Worker Hosts enforce authorization separately.\n */\nexport interface TagContextPlan {\n readonly version: 4;\n readonly capturedAt: string;\n readonly sets: readonly TagContextPlanSet[];\n}\n\nexport function emptyTagContextPlan(capturedAt: string): TagContextPlan {\n return { version: 4, capturedAt, sets: [] };\n}\n\nexport type JsonRecord = Readonly<Record<string, unknown>>;\n\nexport type WorkReferenceRelationship =\n | \"changed\"\n | \"inspected\"\n | \"mentioned\"\n | \"originated-in\"\n | \"produced\";\n\n/** Stable, provider-aware identity used for deterministic Work Record matching. */\nexport interface WorkReference {\n readonly provider: ConnectorProvider;\n readonly connectorAccountId?: string;\n readonly resourceType:\n | \"artifact\"\n | \"channel\"\n | \"file\"\n | \"issue\"\n | \"project\"\n | \"pull-request\"\n | \"repository\"\n | \"thread\";\n readonly resourceId?: string;\n readonly reference: string;\n readonly relationship: WorkReferenceRelationship;\n}\n\nexport interface TaskResult {\n readonly summary: string;\n readonly decisions: readonly {\n readonly text: string;\n readonly status?: \"accepted\" | \"proposed\";\n }[];\n readonly changes: readonly {\n readonly summary: string;\n readonly reference?: string;\n }[];\n readonly unresolved: readonly string[];\n readonly references: readonly WorkReference[];\n readonly artifacts: readonly {\n readonly uri: string;\n readonly mediaType?: string;\n readonly digest?: string;\n }[];\n}\n\nexport interface Session {\n readonly id: string;\n readonly tagId: string;\n readonly workerProfile: WorkerProfileRef;\n readonly sessionKey: string;\n readonly origin: JsonRecord;\n readonly state: \"open\";\n readonly lastInteractionAt: string;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface OpenSessionInput {\n readonly tagId: string;\n readonly workerProfile: WorkerProfileRef;\n readonly sessionKey: string;\n readonly origin: JsonRecord;\n readonly at: string;\n}\n\nexport type TaskStatus = \"cancelled\" | \"completed\" | \"failed\" | \"pending\" | \"running\";\n\nexport interface TaskWorkspaceTarget {\n readonly provider: ConnectorProvider;\n readonly connectorAccountId: string;\n readonly scope: string;\n readonly reference?: string;\n readonly actions: readonly string[];\n}\n\n/**\n * Immutable operational workspace decision captured when a Task is admitted.\n * It is intentionally separate from Context Sets: Context equips a Task, while\n * this plan identifies the repository in which the Worker should operate.\n */\nexport type TaskWorkspacePlan =\n | { readonly version: 1; readonly status: \"none\" }\n | {\n readonly version: 1;\n readonly status: \"selected\";\n readonly selectedBy: \"default\" | \"origin\" | \"request\";\n readonly target: TaskWorkspaceTarget;\n }\n | {\n readonly version: 1;\n readonly status: \"selection-required\";\n readonly choices: readonly TaskWorkspaceTarget[];\n }\n | {\n readonly version: 1;\n readonly status: \"unavailable\";\n readonly requested: readonly string[];\n };\n\n/** One durable unit of user intent admitted for a Tag within a Session. */\nexport interface Task {\n readonly id: string;\n readonly inboundEventId: string;\n readonly tagId: string;\n readonly sessionId: string;\n readonly workerProfile: WorkerProfileRef;\n readonly actor: InboundEventActor;\n readonly trigger: JsonRecord;\n readonly workspacePlan: TaskWorkspacePlan;\n /** Immutable, automatic continuity captured from earlier Tasks in this Session. */\n readonly sessionHistory: readonly WorkRecord[];\n readonly authorizationSnapshot: TagAuthorizationSnapshot;\n readonly contextPlan: TagContextPlan;\n readonly status: TaskStatus;\n readonly startedAt?: string;\n readonly endedAt?: string;\n readonly outcome?: JsonRecord;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface OpenTaskInput {\n readonly inboundEventId: string;\n readonly tagId: string;\n readonly sessionId: string;\n readonly workerProfile: WorkerProfileRef;\n readonly actor: InboundEventActor;\n readonly trigger: JsonRecord;\n readonly workspacePlan: TaskWorkspacePlan;\n readonly sessionHistory: readonly WorkRecord[];\n readonly authorizationSnapshot: TagAuthorizationSnapshot;\n readonly contextPlan: TagContextPlan;\n readonly createdAt: string;\n}\n\nexport interface StartTaskInput {\n readonly taskId: string;\n readonly startedAt: string;\n}\n\nexport interface CloseTaskInput {\n readonly taskId: string;\n readonly status: Exclude<TaskStatus, \"pending\" | \"running\">;\n readonly outcome?: JsonRecord;\n readonly endedAt: string;\n}\n\nexport type TaskAttemptStatus = \"cancelled\" | \"completed\" | \"failed\" | \"running\";\n\n/** One concrete Worker execution or retry of a Task. */\nexport interface TaskAttempt {\n readonly id: string;\n readonly taskId: string;\n readonly attemptNumber: number;\n readonly workerSnapshot: JsonRecord;\n readonly status: TaskAttemptStatus;\n readonly startedAt: string;\n readonly endedAt?: string;\n readonly outcome?: JsonRecord;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface CreateTaskAttemptInput {\n readonly taskId: string;\n readonly attemptNumber: number;\n readonly workerSnapshot: JsonRecord;\n readonly startedAt: string;\n}\n\nexport interface CloseTaskAttemptInput {\n readonly attemptId: string;\n readonly status: Exclude<TaskAttemptStatus, \"running\">;\n readonly outcome?: JsonRecord;\n readonly endedAt: string;\n}\n\nexport interface TaskEvent {\n readonly id: string;\n readonly taskId: string;\n readonly attemptId?: string;\n readonly sequence: number;\n readonly type: string;\n readonly payload?: JsonRecord;\n readonly createdAt: string;\n}\n\nexport const WORK_RECORD_ARTIFACT_KIND = \"supertag.work-record.v1\";\n\n/**\n * Safe, durable continuity record produced from observable Task inputs and\n * outputs. It deliberately excludes hidden reasoning and raw tool logs.\n */\nexport interface WorkRecord {\n readonly version: 1;\n readonly taskId: string;\n readonly sessionId: string;\n readonly tagId: string;\n readonly intent?: string;\n readonly result: TaskResult;\n readonly origin: {\n readonly tagPresenceId: string;\n readonly provider: ConnectorProvider;\n readonly connectorAccountId: string;\n readonly scope: string;\n readonly sessionKey: string;\n readonly source: JsonRecord;\n };\n readonly requester: InboundEventActor;\n readonly resources: readonly {\n readonly provider: ConnectorProvider;\n readonly connectorAccountId: string;\n readonly scope: string;\n readonly reference?: string;\n readonly actions: readonly string[];\n }[];\n readonly references: readonly WorkReference[];\n readonly citation: {\n readonly label: string;\n readonly uri: string;\n };\n readonly completedAt: string;\n}\n\nexport interface Artifact {\n readonly id: string;\n readonly taskId: string;\n readonly kind: string;\n readonly location: string;\n readonly contentHash?: string;\n readonly sourceReferences?: readonly JsonRecord[];\n readonly metadata?: JsonRecord;\n readonly references: readonly WorkReference[];\n readonly createdAt: string;\n}\n\nexport interface CreateArtifactInput {\n readonly taskId: string;\n readonly kind: string;\n readonly location: string;\n readonly contentHash?: string;\n readonly sourceReferences?: readonly JsonRecord[];\n readonly metadata?: JsonRecord;\n readonly references?: readonly WorkReference[];\n readonly createdAt: string;\n}\n\nexport interface ArtifactListFilter {\n readonly taskId?: string;\n readonly sessionId?: string;\n readonly tagId?: string;\n readonly kind?: string;\n readonly relatedTo?: readonly Pick<\n WorkReference,\n \"provider\" | \"resourceType\" | \"resourceId\" | \"reference\"\n >[];\n readonly originSurfaces?: readonly {\n readonly provider: ConnectorProvider;\n readonly connectorAccountId: string;\n readonly scope: string;\n }[];\n readonly createdAfter?: string;\n readonly limit?: number;\n}\n\nexport interface AppendTaskEventInput {\n readonly taskId: string;\n readonly attemptId?: string;\n readonly type: string;\n readonly payload?: JsonRecord;\n readonly createdAt?: string;\n}\n\nexport type InboundEventKind = \"issue\" | \"issue_comment\" | \"mention\" | \"message\" | \"pull_request\";\n\nexport interface InboundEventActor {\n readonly id: string;\n readonly displayName?: string;\n readonly kind: \"bot\" | \"user\" | \"unknown\";\n}\n\nexport interface CallbackRoute {\n readonly provider: ConnectorProvider;\n readonly mode:\n | \"github_issue_comment\"\n | \"lark_thread\"\n | \"linear_issue_comment\"\n | \"slack_thread\"\n | \"teams_thread\";\n readonly threadKey: string;\n readonly target: Readonly<Record<string, string>>;\n}\n\nexport interface InboundConnectorEvent {\n readonly eventId: string;\n readonly logicalEventId: string;\n readonly provider: ConnectorProvider;\n readonly externalAccountId: string;\n readonly kind: InboundEventKind;\n readonly scope: string;\n readonly sessionKey: string;\n readonly actor: InboundEventActor;\n readonly text?: string;\n readonly occurredAt: string;\n readonly callback: CallbackRoute;\n readonly source: Readonly<Record<string, string>>;\n readonly metadata: Readonly<Record<string, string | number | boolean | null>>;\n}\n\nexport interface InboundEventClaimInput {\n readonly connectorAccountId: string;\n readonly eventId: string;\n readonly claimedAt: string;\n}\n\nexport type DurableInboundEventStatus = \"completed\" | \"failed\" | \"pending\" | \"processing\";\n\nexport interface DurableInboundEvent {\n readonly id: string;\n readonly connectorAccountId: string;\n readonly tagPresenceId: string;\n readonly tagId: string;\n readonly authorization: TagAuthorizationSnapshot;\n readonly contextPlan: TagContextPlan;\n readonly event: InboundConnectorEvent;\n readonly status: DurableInboundEventStatus;\n readonly attemptCount: number;\n readonly maxAttempts: number;\n readonly availableAt: string;\n readonly leaseOwner?: string;\n readonly leaseExpiresAt?: string;\n readonly lastError?: string;\n readonly completedAt?: string;\n readonly failedAt?: string;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface AdmitInboundEventInput {\n readonly connectorAccountId: string;\n readonly tagPresenceId: string;\n readonly tagId: string;\n readonly authorization: TagAuthorizationSnapshot;\n readonly contextPlan: TagContextPlan;\n readonly event: InboundConnectorEvent;\n readonly availableAt?: string;\n readonly maxAttempts?: number;\n}\n\nexport type AdmitInboundEventResult =\n | { readonly status: \"admitted\"; readonly work: DurableInboundEvent }\n | { readonly status: \"duplicate\"; readonly work: DurableInboundEvent };\n\nexport interface ClaimDueWorkInput {\n readonly leaseOwner: string;\n readonly now: string;\n readonly leaseExpiresAt: string;\n}\n\nexport interface CompleteInboundEventInput {\n readonly inboundEventId: string;\n readonly leaseOwner: string;\n readonly workerId: string;\n readonly responseText: string;\n readonly completedAt: string;\n}\n\nexport interface RetryInboundEventInput {\n readonly inboundEventId: string;\n readonly leaseOwner: string;\n readonly error: string;\n readonly retryAt: string;\n readonly failedAt: string;\n}\n\nexport type OutboundReplyStatus = \"delivered\" | \"delivering\" | \"failed\" | \"pending\";\n\nexport type OutboundPresentation = \"acknowledgement\" | \"error\" | \"final-result\" | \"status\";\n\nexport interface OutboundReply {\n readonly id: string;\n readonly inboundEventId: string;\n readonly connectorAccountId: string;\n readonly workerId: string;\n readonly event: InboundConnectorEvent;\n readonly callback: CallbackRoute;\n readonly presentation: OutboundPresentation;\n /** Stable idempotency key within one inbound event, such as acknowledgement or final. */\n readonly deliveryKey: string;\n /** Canonical Markdown. The destination connector renders it immediately before delivery. */\n readonly text: string;\n readonly status: OutboundReplyStatus;\n readonly attemptCount: number;\n readonly maxAttempts: number;\n readonly availableAt: string;\n readonly leaseOwner?: string;\n readonly leaseExpiresAt?: string;\n readonly lastError?: string;\n readonly deliveredAt?: string;\n readonly failedAt?: string;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport interface CompleteOutboundReplyInput {\n readonly outboundReplyId: string;\n readonly leaseOwner: string;\n readonly deliveredAt: string;\n}\n\nexport interface EnqueueOutboundReplyInput {\n readonly inboundEventId: string;\n readonly workerId: string;\n readonly presentation: OutboundPresentation;\n readonly deliveryKey: string;\n readonly text: string;\n readonly createdAt: string;\n}\n\nexport interface RetryOutboundReplyInput {\n readonly outboundReplyId: string;\n readonly leaseOwner: string;\n readonly error: string;\n readonly retryAt: string;\n readonly failedAt: string;\n}\n\nexport interface ConnectorAccountInput {\n readonly provider: ConnectorProvider;\n readonly externalAccountId: string;\n readonly displayName: string;\n readonly authMethod: string;\n /** Stable logical identifier; the configured credential vault owns its physical location. */\n readonly credentialId: string;\n readonly status: \"connected\";\n readonly configuration: Readonly<Record<string, unknown>>;\n readonly verifiedAt: string;\n}\n\nexport interface ConnectorAccount extends ConnectorAccountInput {\n readonly id: string;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\n\nexport type CredentialValue = Readonly<Record<string, string>>;\n\n/**\n * Gateway-owned credential persistence. Identifiers are logical and stable across providers;\n * implementations decide whether values live in a local file or an external secret service.\n */\nexport interface GatewayCredentialVault {\n store(credentialId: string, value: CredentialValue): Promise<void>;\n resolve(credentialId: string): Promise<CredentialValue | undefined>;\n delete(credentialId: string): Promise<void>;\n}\n\nexport interface Store {\n readonly provider: DatabaseProvider;\n connect(): Promise<void>;\n disconnect(): Promise<void>;\n createTag(input: CreateTagInput): Promise<Tag>;\n findTagById(id: string): Promise<Tag | undefined>;\n findTagByName(name: string): Promise<Tag | undefined>;\n listTags(): Promise<readonly Tag[]>;\n addTagPresence(input: AddTagPresenceInput): Promise<TagPresence>;\n findTagPresenceById(id: string): Promise<TagPresence | undefined>;\n listTagPresences(filter?: TagPresenceListFilter): Promise<readonly TagPresence[]>;\n removeTagPresence(id: string): Promise<boolean>;\n resolveTagPresence(connectorAccountId: string, scope: string): Promise<TagPresence | undefined>;\n addTagPermission(input: AddTagPermissionInput): Promise<TagPermission>;\n createTagPermissionSet(input: CreateTagPermissionSetInput): Promise<TagPermissionSet>;\n findTagPermissionSetById(id: string): Promise<TagPermissionSet | undefined>;\n findTagPermissionSetByName(tagId: string, name: string): Promise<TagPermissionSet | undefined>;\n listTagPermissionSets(filter?: TagPermissionSetListFilter): Promise<readonly TagPermissionSet[]>;\n removeTagPermissionSet(id: string): Promise<boolean>;\n listTagPermissions(filter?: TagPermissionListFilter): Promise<readonly TagPermission[]>;\n removeTagPermission(id: string): Promise<boolean>;\n activateTagPermissionSet(input: ActivateTagPermissionSetInput): Promise<TagPermissionActivation>;\n listTagPermissionActivations(\n filter?: TagPermissionActivationListFilter,\n ): Promise<readonly TagPermissionActivation[]>;\n deactivateTagPermissionSet(permissionSetId: string, tagPresenceId: string): Promise<boolean>;\n createTagContextSet(input: CreateTagContextSetInput): Promise<TagContextSet>;\n findTagContextSetById(id: string): Promise<TagContextSet | undefined>;\n findTagContextSetByName(tagId: string, name: string): Promise<TagContextSet | undefined>;\n listTagContextSets(filter?: TagContextSetListFilter): Promise<readonly TagContextSet[]>;\n removeTagContextSet(id: string): Promise<boolean>;\n addTagContextItem(input: AddTagContextItemInput): Promise<TagContextItem>;\n listTagContextItems(filter?: TagContextItemListFilter): Promise<readonly TagContextItem[]>;\n removeTagContextItem(id: string): Promise<boolean>;\n activateTagContextSet(input: ActivateTagContextSetInput): Promise<TagContextActivation>;\n listTagContextActivations(\n filter?: TagContextActivationListFilter,\n ): Promise<readonly TagContextActivation[]>;\n deactivateTagContextSet(contextSetId: string, tagPresenceId: string): Promise<boolean>;\n openSession(input: OpenSessionInput): Promise<Session>;\n findSessionById(id: string): Promise<Session | undefined>;\n findSessionByTagAndKey(tagId: string, sessionKey: string): Promise<Session | undefined>;\n openTask(input: OpenTaskInput): Promise<Task>;\n startTask(input: StartTaskInput): Promise<Task>;\n closeTask(input: CloseTaskInput): Promise<Task>;\n findTaskById(id: string): Promise<Task | undefined>;\n createTaskAttempt(input: CreateTaskAttemptInput): Promise<TaskAttempt>;\n closeTaskAttempt(input: CloseTaskAttemptInput): Promise<TaskAttempt>;\n listTaskAttempts(taskId: string): Promise<readonly TaskAttempt[]>;\n appendTaskEvent(input: AppendTaskEventInput): Promise<TaskEvent>;\n listTaskEvents(taskId: string): Promise<readonly TaskEvent[]>;\n createArtifact(input: CreateArtifactInput): Promise<Artifact>;\n findArtifactById(id: string): Promise<Artifact | undefined>;\n listArtifacts(filter?: ArtifactListFilter): Promise<readonly Artifact[]>;\n saveConnectorAccount(input: ConnectorAccountInput): Promise<ConnectorAccount>;\n findConnectorAccount(\n provider: ConnectorProvider,\n externalAccountId: string,\n ): Promise<ConnectorAccount | undefined>;\n findConnectorAccountById(id: string): Promise<ConnectorAccount | undefined>;\n listConnectorAccounts(): Promise<readonly ConnectorAccount[]>;\n admitInboundEvent(input: AdmitInboundEventInput): Promise<AdmitInboundEventResult>;\n claimNextInboundEvent(input: ClaimDueWorkInput): Promise<DurableInboundEvent | undefined>;\n completeInboundEvent(input: CompleteInboundEventInput): Promise<OutboundReply>;\n enqueueOutboundReply(input: EnqueueOutboundReplyInput): Promise<OutboundReply>;\n retryInboundEvent(input: RetryInboundEventInput): Promise<\"failed\" | \"pending\">;\n claimNextOutboundReply(input: ClaimDueWorkInput): Promise<OutboundReply | undefined>;\n completeOutboundReply(input: CompleteOutboundReplyInput): Promise<void>;\n retryOutboundReply(input: RetryOutboundReplyInput): Promise<\"failed\" | \"pending\">;\n claimInboundEvent(input: InboundEventClaimInput): Promise<boolean>;\n releaseInboundEventClaim(connectorAccountId: string, eventId: string): Promise<void>;\n}\n\nexport const CORE_VERSION = \"0.0.0\";\n"]}