@fourier-labs/harbour-contracts 0.45.0 → 0.47.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 (39) hide show
  1. package/README.md +4 -4
  2. package/contract-release.json +28 -28
  3. package/dist/gen-ts/ai-policy-snapshot.d.ts +19 -0
  4. package/dist/gen-ts/ai-runtime-contract.d.ts +1 -1
  5. package/dist/gen-ts/ai-trace-event.d.ts +4 -1
  6. package/dist/gen-ts/app-integrations-declaration.d.ts +8 -2
  7. package/dist/gen-ts/contract-release.d.ts +6 -6
  8. package/dist/gen-ts/contract-release.js +6 -6
  9. package/dist/gen-ts/data-grant-v2.d.ts +60 -16
  10. package/dist/gen-ts/integration-error-details.d.ts +2 -2
  11. package/dist/gen-ts/integration-execute-request.d.ts +6 -2
  12. package/dist/gen-ts/integration-execute-result.d.ts +21 -1
  13. package/dist/gen-ts/kit-bundle-manifest.d.ts +8 -0
  14. package/dist/gen-ts/kit-lock.d.ts +8 -0
  15. package/dist/gen-ts/saas-connection.d.ts +80 -29
  16. package/dist/resolver/index.d.ts +7 -1
  17. package/gen-ts/ai-policy-snapshot.ts +19 -0
  18. package/gen-ts/ai-runtime-contract.ts +1 -1
  19. package/gen-ts/ai-trace-event.ts +4 -1
  20. package/gen-ts/app-integrations-declaration.ts +8 -2
  21. package/gen-ts/contract-release.ts +6 -6
  22. package/gen-ts/data-grant-v2.ts +62 -16
  23. package/gen-ts/integration-error-details.ts +10 -2
  24. package/gen-ts/integration-execute-request.ts +7 -2
  25. package/gen-ts/integration-execute-result.ts +21 -1
  26. package/gen-ts/kit-bundle-manifest.ts +8 -0
  27. package/gen-ts/kit-lock.ts +8 -0
  28. package/gen-ts/saas-connection.ts +82 -29
  29. package/package.json +1 -1
  30. package/schema/ai-policy-snapshot.schema.json +13 -1
  31. package/schema/ai-runtime-contract.schema.json +1 -1
  32. package/schema/ai-trace-event.schema.json +7 -1
  33. package/schema/app-integrations-declaration.schema.json +19 -5
  34. package/schema/data-grant-v2.schema.json +102 -23
  35. package/schema/integration-error-details.schema.json +10 -2
  36. package/schema/integration-execute-request.schema.json +27 -6
  37. package/schema/integration-execute-result.schema.json +34 -1
  38. package/schema/kit-bundle-manifest.schema.json +9 -2
  39. package/schema/saas-connection.schema.json +97 -41
@@ -1,59 +1,98 @@
1
+ /**
2
+ * Slack carries an installation and a channel map; Gmail is user-consent only and read-only.
3
+ */
4
+ export type SaasProvider = 'slack' | 'gmail';
1
5
  /**
2
6
  * DISABLED stops every app call immediately (details.code CONNECTION_DISABLED).
3
7
  */
4
8
  export type SaasConnectionStatus = 'ACTIVE' | 'DISABLED';
9
+ export type SaasInstallationStatus = 'installed' | 'reconnect_required' | 'revoked';
10
+ /**
11
+ */
5
12
  export type InstallationName = string;
6
13
  /**
7
- * Tenant-wide SaaS connection record (control table sk SAASCONN#<sourceId>, same tenant partition as database sources; alias uniqueness is enforced across both). IT maps each environment to a provider installation and logical channel aliases to channel IDs; apps only ever see the aliases. Contains references, never secrets: the client secret lives in Secrets Manager under clientSecretRef and installation tokens under their own token records.
14
+ * Tenant-wide SaaS connection record (control table sk SAASCONN#<sourceId>, same tenant partition as database sources; alias uniqueness is enforced across both). One connection per tenant and provider: a single bot installation of the platform-owned provider app and a single logical channel map shared by every app environment (grants, requests and user consent links stay per environment). A Gmail connection has neither installation nor channels: user consent is the only step and its one resource is the fixed `inbox` alias. Contains references, never secrets: installation tokens live under their own token records. The pre-T25 per-environment shape (`clientId`, `clientSecretRef`, `environments`, `installations`) is deprecated: the control plane normalises such a stored record on read and never writes it.
8
15
  */
9
16
  export interface SaasConnection {
17
+ schema: 'harbour.saas-connection/1.0';
18
+ tenantId: string;
10
19
  /**
11
20
  * Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
12
21
  */
13
22
  sourceId: string;
14
23
  kind: 'saas';
15
- provider: 'slack';
24
+ provider: SaasProvider;
16
25
  displayName: string;
17
26
  status: SaasConnectionStatus;
18
27
  /**
19
28
  * Optimistic-concurrency version; every write is conditional on it.
20
29
  */
21
30
  version: number;
22
- clientId: string;
31
+ installation?: SaasInstallation;
23
32
  /**
24
- * secretref://tenant/{tenantId}/saas/{sourceId}/client
33
+ * Logical channel alias -> provider channel ID, shared by every environment. Always empty for Gmail.
25
34
  */
26
- clientSecretRef?: string;
27
- environments: {
28
- development?: SaasEnvironmentMapping;
29
- preview?: SaasEnvironmentMapping;
30
- production?: SaasEnvironmentMapping;
35
+ channels: {
36
+ /**
37
+ * Provider channel ID; only public, non-archived channels are valid.
38
+ */
39
+ [k: string]: string;
31
40
  };
32
41
  /**
33
- * Operations IT allows apps to request on this connection.
42
+ * Operations IT allows apps to request on this connection: the provider's own SaaS operations (Slack: slack.channel.history, slack.message.post; Gmail: gmail.thread.list, gmail.message.read). Never warehouse.view.read.
34
43
  *
35
44
  * @minItems 1
36
- * @maxItems 2
45
+ * @maxItems 4
37
46
  */
38
- operations: ('slack.channel.history' | 'slack.message.post')[];
47
+ operations: ('slack.channel.history' | 'slack.message.post' | 'gmail.thread.list' | 'gmail.message.read' | 'warehouse.view.read')[];
39
48
  developmentPreapproval: DevelopmentPreapproval;
40
49
  /**
41
- * Provider installations keyed by the installation name environments point at.
50
+ * Lower-cased builder emails excluded from development preapproval.
51
+ *
52
+ * @maxItems 256
53
+ */
54
+ blockedDevelopmentBuilders?: string[];
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ /**
58
+ * @deprecated
59
+ * Deprecated (pre-T25 tenant-owned provider client). Dropped on read; never written.
60
+ */
61
+ clientId?: string;
62
+ /**
63
+ * @deprecated
64
+ * Deprecated (pre-T25 tenant-owned provider client secret reference). Dropped on read; never written.
65
+ */
66
+ clientSecretRef?: string;
67
+ /**
68
+ * @deprecated
69
+ * Deprecated pre-T25 per-environment mapping. On read the development entry's channels become `channels`; never written.
70
+ */
71
+ environments?: {
72
+ development?: SaasEnvironmentMapping;
73
+ preview?: SaasEnvironmentMapping;
74
+ production?: SaasEnvironmentMapping;
75
+ };
76
+ /**
77
+ * @deprecated
78
+ * Deprecated pre-T25 named installations. On read the `nonprod` entry (or the development mapping's) becomes `installation`; never written.
42
79
  */
43
80
  installations?: {
44
- [k: string]: SaasInstallation;
81
+ [k: string]: LegacySaasInstallation;
45
82
  };
46
- createdAt?: string;
47
- updatedAt?: string;
48
83
  }
49
- export interface SaasEnvironmentMapping {
50
- installation: InstallationName;
51
- channels: {
52
- /**
53
- * Provider channel ID; only public, non-archived channels are valid.
54
- */
55
- [k: string]: string;
56
- };
84
+ /**
85
+ * The one bot installation of the platform-owned provider app in this tenant's workspace.
86
+ */
87
+ export interface SaasInstallation {
88
+ tokenRecordId: string;
89
+ workspaceId: string;
90
+ /**
91
+ * Empty only for a legacy record normalised without one.
92
+ */
93
+ botUserId: string;
94
+ status: SaasInstallationStatus;
95
+ installedAt: string;
57
96
  }
58
97
  export interface DevelopmentPreapproval {
59
98
  /**
@@ -65,9 +104,21 @@ export interface DevelopmentPreapproval {
65
104
  */
66
105
  hours: number;
67
106
  }
68
- export interface SaasInstallation {
69
- tokenRecordId: string;
70
- workspaceId: string;
71
- botUserId: string;
72
- status: 'ACTIVE' | 'RECONNECT_REQUIRED' | 'REVOKED';
107
+ /**
108
+ * @deprecated
109
+ */
110
+ export interface SaasEnvironmentMapping {
111
+ installation: InstallationName;
112
+ channels: {
113
+ [k: string]: string;
114
+ };
115
+ }
116
+ /**
117
+ * @deprecated
118
+ */
119
+ export interface LegacySaasInstallation {
120
+ tokenRecordId?: string;
121
+ workspaceId?: string;
122
+ botUserId?: string;
123
+ status?: 'ACTIVE' | 'RECONNECT_REQUIRED' | 'REVOKED';
73
124
  }
@@ -136,7 +136,13 @@ export declare function canonicalJson(value: unknown): string;
136
136
  * to compile until someone states its merge rules. A `Pick<>` here previously
137
137
  * let a seventh family parse, store, and enter the snapshot digest while being
138
138
  * silently dropped from the effective policy. */
139
- type AiPolicySnapshotIdentity = "schema" | "scope" | "revision" | "publishedAt" | "contentDigest" | "baselineDigest" | "classificationMinimum";
139
+ /** `assignments` sits here with `classificationMinimum` for the same reason:
140
+ * both are scope-LEVEL statements resolution consumes directly from the
141
+ * application snapshot (the classification raises the floor; the assignments
142
+ * select among the merged families by name), not per-entry families the
143
+ * tenant merge narrows. Excluding them keeps `SCOPE_FAMILY_MERGES` a registry
144
+ * of genuine family merges. */
145
+ type AiPolicySnapshotIdentity = "schema" | "scope" | "revision" | "publishedAt" | "contentDigest" | "baselineDigest" | "classificationMinimum" | "assignments";
140
146
  /** The resource families a scope snapshot contributes to resolution. */
141
147
  export type AiScopePolicySet = Omit<AiPolicySnapshot, AiPolicySnapshotIdentity>;
142
148
  /** The merged control set every later layer narrowed but could not weaken. */
@@ -86,6 +86,7 @@ export interface AiPolicySnapshot {
86
86
  */
87
87
  limits: AiPolicyLimit[];
88
88
  retention: AiPolicyRetention;
89
+ assignments?: AiPolicyAssignments;
89
90
  }
90
91
  export interface AiPolicyClassificationMinimum {
91
92
  classification: 'Green' | 'Yellow' | 'Orange' | 'Red';
@@ -204,3 +205,21 @@ export interface AiPolicyRetention {
204
205
  */
205
206
  revealRoles: AiPolicyIdentifier[];
206
207
  }
208
+ /**
209
+ * Application-scope only: the tenant resources this application/environment snapshot pins BY NAME (D-8/D-9). A scope without assignments keeps the default rule (the whole merge-narrowed set is the assignment). Every name must exist in the same snapshot's own family; empty route and budget selections are legal (tenant-scoped limits bind regardless).
210
+ */
211
+ export interface AiPolicyAssignments {
212
+ /**
213
+ * @maxItems 256
214
+ */
215
+ routes: AiPolicyIdentifier[];
216
+ /**
217
+ * @minItems 1
218
+ * @maxItems 256
219
+ */
220
+ policies: AiPolicyIdentifier[];
221
+ /**
222
+ * @maxItems 128
223
+ */
224
+ budgets: AiPolicyIdentifier[];
225
+ }
@@ -53,7 +53,7 @@ export interface AiRuntimeContract {
53
53
  export interface AiConfigurationMappingDescriptor {
54
54
  mappingId: string;
55
55
  version: string;
56
- protocol: 'openai-chat';
56
+ protocol: 'openai-chat' | 'openai-images';
57
57
  providerId: string;
58
58
  apiKeyEnvironmentName: string;
59
59
  baseUrlEnvironmentName: string;
@@ -20,7 +20,10 @@ export type AiTraceEvent = {
20
20
  provider?: 'openai' | 'anthropic' | 'gemini' | 'openrouter' | 'deepseek' | 'elevenlabs' | 'deepgram' | 'higgsfield';
21
21
  providerModel?: string;
22
22
  outcome: 'succeeded' | 'blocked' | 'failed' | 'cancelled';
23
- usage?: AiTraceUsage;
23
+ /**
24
+ * Trace-level provider-reported usage, or null when no attempt reported any (the reservation stays committed rather than reconciled against invented zero usage).
25
+ */
26
+ usage?: AiTraceUsage | null;
24
27
  priceRevision?: AiTraceIdentifier;
25
28
  costMicroUsd: number;
26
29
  latencyMs: number;
@@ -11,9 +11,13 @@ export type IntegrationAlias = string;
11
11
  * @maxItems 64
12
12
  */
13
13
  export type ResourceNames = IntegrationAlias[];
14
+ /**
15
+ * A plain column identifier of a warehouse view.
16
+ */
17
+ export type ColumnName = string;
14
18
 
15
19
  /**
16
- * Committed `.harbour/integrations.json`: the app's declared use of tenant-wide integration connections. Keys are logical connection aliases (the governance sourceId); resources are logical names (Slack channel alias, warehouse view name), never IDs, tokens or URLs. The operation set is closed (three operations) and each operation carries a fixed identity mode: slack.channel.history=user, slack.message.post=app, warehouse.view.read=app. A `saas` connection may declare only the Slack operations and a `database` connection only warehouse.view.read. This file also owns the shared IntegrationOperation / IntegrationIdentityMode / IntegrationEnvironment / IntegrationConnectionKind enums referenced by the other integration schemas.
20
+ * Committed `.harbour/integrations.json`: the app's declared use of tenant-wide integration connections. Keys are logical connection aliases (the governance sourceId); resources are logical names (Slack channel alias, warehouse view name), never IDs, tokens or URLs. The operation set is closed (five operations) and each operation carries a fixed identity mode: slack.channel.history=user, slack.message.post=app, gmail.thread.list=user, gmail.message.read=user, warehouse.view.read=app. A `saas` connection may declare only the Slack and Gmail operations and a `database` connection only warehouse.view.read. Gmail is read-only and user-mode only; its single resource is the fixed `inbox` alias. This file also owns the shared IntegrationOperation / IntegrationIdentityMode / IntegrationEnvironment / IntegrationConnectionKind enums referenced by the other integration schemas.
17
21
  */
18
22
  export interface AppIntegrationsDeclaration {
19
23
  schema: 'harbour.app-integrations/2.0';
@@ -26,6 +30,8 @@ export interface DeclaredConnection {
26
30
  operations: {
27
31
  'slack.channel.history'?: UserModeChannelOperation;
28
32
  'slack.message.post'?: AppModeChannelOperation;
33
+ 'gmail.thread.list'?: UserModeChannelOperation;
34
+ 'gmail.message.read'?: UserModeChannelOperation;
29
35
  'warehouse.view.read'?: AppModeViewOperation;
30
36
  };
31
37
  }
@@ -48,5 +54,5 @@ export interface ViewResource {
48
54
  * @minItems 1
49
55
  * @maxItems 32
50
56
  */
51
- columns: string[];
57
+ columns: ColumnName[];
52
58
  }
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable */
2
2
  // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
3
 
4
- export const ContractRepositoryVersion = "0.45.0.0" as const;
5
- export const ContractPublishVersion = "0.45.0" as const;
6
- export const ContractPublishTag = "v0.45.0" as const;
7
- export const ContractSchemasDigest = "sha256:4cef9cebaaa623a613cb8c748558a9ac5d3622aeca31138f17c983cd8cfb6eb3" as const;
4
+ export const ContractRepositoryVersion = "0.47.0.0" as const;
5
+ export const ContractPublishVersion = "0.47.0" as const;
6
+ export const ContractPublishTag = "v0.47.0" as const;
7
+ export const ContractSchemasDigest = "sha256:9d059261d1fbe550fbd4e265287397d6913912c3d5ea6570b2b29d2e6619de4f" as const;
8
8
  export const ContractAiFixturesDigest = "sha256:edac31c92e146ca1c40130f2fb5649db82e24b8cd1ac758153b90612052fddb6" as const;
9
- export const ContractGeneratedGoDigest = "sha256:4134b582754e02f9248bcb579a4ec335da3ab1d87d92b3720d9ac8ee3cb1eec1" as const;
10
- export const ContractGeneratedTypeScriptDigest = "sha256:a57c25fdfbb06518e95bade4dd57441d39a2bb3f11fbbd8d78df5e8773d0ca9b" as const;
9
+ export const ContractGeneratedGoDigest = "sha256:5892b40bfbac4c9a86f671a0eb54ef530f65ba97e5abc0b3713495bbbdfbf4e2" as const;
10
+ export const ContractGeneratedTypeScriptDigest = "sha256:0bb0c87edaa9399cac1c927ba80dc25ff96f7364678e7f0a17599a34a26c170b" as const;
@@ -9,46 +9,53 @@ export type DataGrantV2Status = 'REQUESTED' | 'GRANTED' | 'DENIED' | 'REVOKED';
9
9
  * Provider-side work for the current approved scope (credential mint, cleanup, installation check).
10
10
  */
11
11
  export type DataGrantV2ProvisioningStatus = 'NONE' | 'PENDING' | 'FAILED' | 'DONE';
12
+ export type DataGrantV2CleanupStatus = 'PENDING' | 'FAILED' | 'DONE';
12
13
 
13
14
  /**
14
- * An app's integration grant for one connection, environment and identity mode (control table sk APP#<appId>#IGRANT#<environment>#<sourceId>#<mode>; grantId = base64url(JSON ["v2",appId,environment,sourceId,mode])). Additive to the legacy DataGrant (data-grant.schema.json), which is never consulted by v2 paths. Expiry is enforced from UTC time on every call and SDK calls never extend it. Status edges live in x-transitions; DENIED and REVOKED are terminal (a regrant after revocation is a new REQUESTED record once cleanup is DONE). Database grants add credentialRef/mintedPrincipal, SaaS grants add installation; both hold references only.
15
+ * An app's integration grant for one connection, environment and identity mode (control table sk APP#<appId>#IGRANT#<environment>#<sourceId>#<mode>; grantId = base64url(JSON ["v2",appId,environment,sourceId,mode])). Additive to the legacy DataGrant (data-grant.schema.json), which is never consulted by v2 paths. A fresh REQUESTED record carries empty `operations`/`resources` until the attached request is approved; approved resources are structured `{name, columns?}` entries (a Slack channel alias, the fixed Gmail `inbox` alias, or a warehouse view alias with its approved columns). Expiry is enforced from UTC time on every call and SDK calls never extend it; `expiredAt` is stamped by the recovery sweep afterwards. Status edges live in x-transitions; DENIED and REVOKED are terminal (a regrant after revocation is a new REQUESTED record once cleanup is DONE). Database grants add credentialRef/mintedPrincipal; both hold references only. `identityMode` and `installation` are the deprecated 0.45.0 spellings: the record carries `mode`, and a SaaS grant runs on the connection's single installation.
15
16
  */
16
17
  export interface DataGrantV2 {
17
18
  schema: 'harbour.data-grant/2.0';
19
+ tenantId: string;
18
20
  appId: string;
19
- /**
20
- * Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
21
- */
22
- sourceId: string;
23
- kind: 'saas' | 'database';
24
21
  /**
25
22
  * development is the CLI/local kit; preview and production are hosted.
26
23
  */
27
24
  environment: 'development' | 'preview' | 'production';
25
+ /**
26
+ * Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
27
+ */
28
+ sourceId: string;
28
29
  /**
29
30
  * Whose authority an operation runs under. Fixed per operation; callers never choose it.
30
31
  */
31
- identityMode: 'app' | 'user';
32
+ mode: 'app' | 'user';
33
+ kind: 'saas' | 'database';
32
34
  status: DataGrantV2Status;
33
35
  /**
34
- * Approved operations; each must match this grant's identityMode.
36
+ * Approved operations; each must match this grant's mode. Empty until the first approval.
35
37
  *
36
- * @minItems 1
37
- * @maxItems 3
38
+ * @maxItems 5
38
39
  */
39
- operations: ('slack.channel.history' | 'slack.message.post' | 'warehouse.view.read')[];
40
+ operations: (
41
+ 'slack.channel.history' | 'slack.message.post' | 'gmail.thread.list' | 'gmail.message.read' | 'warehouse.view.read'
42
+ )[];
40
43
  /**
41
- * Approved logical resource names (channel aliases or view names). Never inherited by wildcard.
44
+ * Approved logical resources. Never inherited by wildcard. Empty until the first approval.
42
45
  *
43
- * @minItems 1
44
46
  * @maxItems 64
45
47
  */
46
- resources: string[];
48
+ resources: IntegrationResource[];
47
49
  /**
48
50
  * Absent only for explicitly approved ongoing production access.
49
51
  */
50
52
  expiresAt?: string;
53
+ /**
54
+ * Set by the recovery sweep once expiry has passed; enforcement itself is the UTC check on every call.
55
+ */
56
+ expiredAt?: string;
51
57
  approvedBy?: string;
58
+ approvedAt?: string;
52
59
  /**
53
60
  * Optimistic-concurrency version; approvals compare it with the reviewed value.
54
61
  */
@@ -59,18 +66,42 @@ export interface DataGrantV2 {
59
66
  pendingRequestId?: string;
60
67
  provisioning: DataGrantV2Provisioning;
61
68
  /**
62
- * Database grants: secretref://tenant/{t}/app/{a}/env/{env}/source/{s}.
69
+ * Database grants: secretref://tenant/{t}/app/{a}/env/{env}/source/{s}. Set only by a successful publish and removed by cleanup.
63
70
  */
64
71
  credentialRef?: string;
65
72
  /**
66
73
  * Database grants: the deterministic per tenant/app/environment/source principal.
67
74
  */
68
75
  mintedPrincipal?: string;
76
+ createdAt: string;
77
+ updatedAt: string;
69
78
  /**
70
- * SaaS grants: the connection installation this environment maps to.
79
+ * @deprecated
80
+ * Whose authority an operation runs under. Fixed per operation; callers never choose it.
81
+ */
82
+ identityMode?: 'app' | 'user';
83
+ /**
84
+ * @deprecated
85
+ * Deprecated: a SaaS grant runs on the connection's single installation; the control plane never writes it.
71
86
  */
72
87
  installation?: string;
73
88
  }
89
+ /**
90
+ * One approved logical resource: a channel alias, the fixed Gmail `inbox` alias, or a warehouse view alias with the approved columns.
91
+ */
92
+ export interface IntegrationResource {
93
+ /**
94
+ * Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
95
+ */
96
+ name: string;
97
+ /**
98
+ * warehouse.view.read only: the approved columns of the view.
99
+ *
100
+ * @minItems 1
101
+ * @maxItems 32
102
+ */
103
+ columns?: string[];
104
+ }
74
105
  export interface DataGrantV2Provisioning {
75
106
  status: DataGrantV2ProvisioningStatus;
76
107
  /**
@@ -81,6 +112,21 @@ export interface DataGrantV2Provisioning {
81
112
  * Sanitized reason; never a provider error body.
82
113
  */
83
114
  lastError?: string;
115
+ /**
116
+ * Conditional worker lease serialising database mutations (120 s).
117
+ */
118
+ lease?: {
119
+ until: string;
120
+ owner: string;
121
+ };
122
+ /**
123
+ * Provider-side cleanup after revocation or expiry; a FAILED cleanup waits for an admin retry-cleanup.
124
+ */
125
+ cleanup?: {
126
+ status: DataGrantV2CleanupStatus;
127
+ attempts: number;
128
+ lastError?: string;
129
+ };
84
130
  }
85
131
 
86
132
  const legalDataGrantV2StatusTransitions: Record<string, Record<string, true>> = {
@@ -7,7 +7,7 @@
7
7
  export type IntegrationErrorCategory =
8
8
  'AUTH_REQUIRED' | 'FORBIDDEN' | 'NOT_FOUND' | 'CONFLICT' | 'VALIDATION_FAILED' | 'RATE_LIMITED' | 'UNAVAILABLE';
9
9
  /**
10
- * Stable reason codes. SEND_OUTCOME_UNKNOWN: dispatch happened but the outcome is unknown; never re-post automatically. SEND_KEY_REUSED: the idempotency key was seen with a different payload or subject. GRANT_DENIED: IT denied the request. TOKEN_REFRESH_PENDING: another call holds the refresh lease; retry shortly. REQUEST_PENDING: a different request for this grant is still open.
10
+ * Stable reason codes. SEND_OUTCOME_UNKNOWN: dispatch happened but the outcome is unknown; never re-post automatically. SEND_KEY_REUSED: the idempotency key was seen with a different payload or subject. GRANT_DENIED: IT denied the request. TOKEN_REFRESH_PENDING: another call holds the refresh lease; retry shortly. REQUEST_PENDING: a different request for this grant is still open. INPUT_INVALID: the operation input failed its bounds. IDEMPOTENCY_KEY_REQUIRED: a send without a UUID idempotencyKey. SEND_IN_PROGRESS: a retry arrived while the first send of that key is still running. CONNECTION_NOT_FOUND / APP_NOT_FOUND / GRANT_NOT_FOUND: the named record does not exist. AUTH_REQUIRED: no verified caller. UNAVAILABLE: the governance dependency (store, provider seam) is unreachable.
11
11
  */
12
12
  export type IntegrationErrorCode =
13
13
  | 'USER_CONNECTION_REQUIRED'
@@ -29,7 +29,15 @@ export type IntegrationErrorCode =
29
29
  | 'APP_ACCESS_REQUIRED'
30
30
  | 'GRANT_DENIED'
31
31
  | 'TOKEN_REFRESH_PENDING'
32
- | 'REQUEST_PENDING';
32
+ | 'REQUEST_PENDING'
33
+ | 'INPUT_INVALID'
34
+ | 'IDEMPOTENCY_KEY_REQUIRED'
35
+ | 'SEND_IN_PROGRESS'
36
+ | 'CONNECTION_NOT_FOUND'
37
+ | 'APP_NOT_FOUND'
38
+ | 'GRANT_NOT_FOUND'
39
+ | 'AUTH_REQUIRED'
40
+ | 'UNAVAILABLE';
33
41
 
34
42
  /**
35
43
  * The `error` member of an integration failure response `{error, requestId}` on the execute/connect routes; the SDK maps it onto HarbourError(category, message, details). `category` is the app-SDK HarbourErrorCategory (not the deployment pipeline's dot-path error-category registry), with the HTTP status fixed per category: 401 AUTH_REQUIRED, 403 FORBIDDEN (denied/revoked/expired), 404 NOT_FOUND (unknown app/connection/resource), 409 CONFLICT (pending provisioning/consent/concurrent request), 400 or 413 VALIDATION_FAILED (invalid input / size overflow), 429 RATE_LIMITED (+ Retry-After header), 503 UNAVAILABLE. `details.code` is the closed stable reason set; `message` is human-facing and never carries provider error bodies, tokens or SQL.
@@ -2,7 +2,7 @@
2
2
  // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
3
 
4
4
  /**
5
- * Body of POST /_harbour/integrations/execute (app SDK), forwarded unchanged to the governance development and runtime execute routes. Exactly one declared operation against one declared resource. The identity mode is NOT a caller field: it is fixed by the operation and enforced from the approved grant; any identity/userId/scope field is rejected by additionalProperties. Per-operation input bounds: slack.channel.history {limit? 1..15, default 15}; slack.message.post {text 1..4000 chars} and a required idempotencyKey retained across retries of one explicit Send; warehouse.view.read {columns 1..32, limit? 1..1000, default 100}. Transport limits (not expressible here): request <= 16 KiB, total deadline 10 s.
5
+ * Body of POST /_harbour/integrations/execute (app SDK), forwarded unchanged to the governance development and runtime execute routes. Exactly one declared operation against one declared resource. The identity mode is NOT a caller field: it is fixed by the operation and enforced from the approved grant; any identity/userId/scope field is rejected by additionalProperties. Per-operation input bounds: slack.channel.history {limit? 1..15, default 15}; slack.message.post {text 1..4000 chars} and a required idempotencyKey retained across retries of one explicit Send; gmail.thread.list {limit? 1..15, default 15}; gmail.message.read {messageId}; warehouse.view.read {columns 1..32, limit? 1..1000, default 100}. Transport limits (not expressible here): request <= 16 KiB, total deadline 10 s.
6
6
  */
7
7
  export type IntegrationExecuteRequest = {
8
8
  /**
@@ -12,7 +12,8 @@ export type IntegrationExecuteRequest = {
12
12
  /**
13
13
  * Closed operation set. Extending it is a contracts change.
14
14
  */
15
- operation: 'slack.channel.history' | 'slack.message.post' | 'warehouse.view.read';
15
+ operation:
16
+ 'slack.channel.history' | 'slack.message.post' | 'gmail.thread.list' | 'gmail.message.read' | 'warehouse.view.read';
16
17
  /**
17
18
  * Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
18
19
  */
@@ -20,6 +21,10 @@ export type IntegrationExecuteRequest = {
20
21
  input: {
21
22
  limit?: number;
22
23
  text?: string;
24
+ /**
25
+ * gmail.message.read: the Gmail message id a gmail.thread.list result named.
26
+ */
27
+ messageId?: string;
23
28
  /**
24
29
  * @minItems 1
25
30
  * @maxItems 32
@@ -2,7 +2,7 @@
2
2
  // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
3
 
4
4
  /**
5
- * The `data` member of a successful execute response `{data, requestId}`; the SDK unwraps `data`. Exactly one of the three operation results: slack.channel.history -> {messages, hasMore} (plain text/IDs/time only, never the provider payload); slack.message.post -> {messageId}; warehouse.view.read -> {rows} (decimal/64-bit values as strings, dates as ISO strings). An unknown send outcome is never a result; it is an error with details.code SEND_OUTCOME_UNKNOWN. Results over 1 MiB are rejected, not truncated.
5
+ * The `data` member of a successful execute response `{data, requestId}`; the SDK unwraps `data`. Exactly one of the five operation results: slack.channel.history -> {messages, hasMore} (plain text/IDs/time only, never the provider payload); slack.message.post -> {messageId}; gmail.thread.list -> {threads, hasMore} (newest inbox threads; each `messageId` is the thread's newest message, what gmail.message.read takes); gmail.message.read -> {id, threadId, subject, from, to, date, text, truncated} (headers plus the plain text with html stripped, cut at 16 KiB with `truncated` set); warehouse.view.read -> {rows} (decimal/64-bit values as strings, dates as ISO strings). An unknown send outcome is never a result; it is an error with details.code SEND_OUTCOME_UNKNOWN. Results over 1 MiB are rejected, not truncated.
6
6
  */
7
7
  export type IntegrationExecuteResult = {
8
8
  /**
@@ -11,6 +11,18 @@ export type IntegrationExecuteResult = {
11
11
  messages?: ChannelMessage[];
12
12
  hasMore?: boolean;
13
13
  messageId?: string;
14
+ /**
15
+ * @maxItems 15
16
+ */
17
+ threads?: GmailThread[];
18
+ id?: string;
19
+ threadId?: string;
20
+ subject?: string;
21
+ from?: string;
22
+ to?: string;
23
+ date?: string;
24
+ text?: string;
25
+ truncated?: boolean;
14
26
  /**
15
27
  * @maxItems 1000
16
28
  */
@@ -25,3 +37,11 @@ export interface ChannelMessage {
25
37
  authorId: string;
26
38
  createdAt: string;
27
39
  }
40
+ export interface GmailThread {
41
+ id: string;
42
+ messageId: string;
43
+ subject: string;
44
+ from: string;
45
+ date: string;
46
+ snippet: string;
47
+ }
@@ -17,10 +17,18 @@ export interface KitBundleManifest {
17
17
  kitVersion: string;
18
18
  sdk: {
19
19
  package: '@harbour/app-sdk';
20
+ /**
21
+ * The SDK package version the tarball was packed from (informational; compatibility is decided by tarballSha256).
22
+ */
23
+ version?: string;
20
24
  /**
21
25
  * SHA-256 of the SDK tarball baked into this bundle; the CodeBuild gate compares it with the pipeline's own tarball.
22
26
  */
23
27
  tarballSha256: string;
28
+ /**
29
+ * Where the CLI downloads the SDK tarball from when it is not shipped inline; the bytes are verified against tarballSha256 before install. The publisher may name the location by content address (for example an OCI blob whose path ends in sha256:<tarballSha256>).
30
+ */
31
+ url?: string;
24
32
  };
25
33
  images: {
26
34
  appGateway: ImageDigestReference;
@@ -23,10 +23,18 @@ interface KitBundleManifest {
23
23
  kitVersion: string;
24
24
  sdk: {
25
25
  package: '@harbour/app-sdk';
26
+ /**
27
+ * The SDK package version the tarball was packed from (informational; compatibility is decided by tarballSha256).
28
+ */
29
+ version?: string;
26
30
  /**
27
31
  * SHA-256 of the SDK tarball baked into this bundle; the CodeBuild gate compares it with the pipeline's own tarball.
28
32
  */
29
33
  tarballSha256: string;
34
+ /**
35
+ * Where the CLI downloads the SDK tarball from when it is not shipped inline; the bytes are verified against tarballSha256 before install. The publisher may name the location by content address (for example an OCI blob whose path ends in sha256:<tarballSha256>).
36
+ */
37
+ url?: string;
30
38
  };
31
39
  images: {
32
40
  /**