@ekanos/sdk 0.21.0 → 0.23.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 +16 -17
- package/api-report.md +5 -2
- package/dist/components/base-activation-form.d.ts +55 -20
- package/dist/components/base-activation-form.js +39 -10
- package/dist/components/base-activation-form.js.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/oauth-activation-form.d.ts +3 -3
- package/dist/components/oauth-activation-form.js +5 -5
- package/dist/components/oauth-activation-form.js.map +1 -1
- package/dist/components/widgets/widget.d.ts +19 -10
- package/dist/components/widgets/widget.js +12 -12
- package/dist/components/widgets/widget.js.map +1 -1
- package/dist/experience/client.js +3 -3
- package/dist/experience/client.js.map +1 -1
- package/dist/experience/define-experience.d.ts +2 -2
- package/dist/experience/define-experience.js.map +1 -1
- package/dist/experience/runtime.d.ts +3 -2
- package/dist/experience/runtime.js.map +1 -1
- package/dist/experience/workflow-template.d.ts +11 -0
- package/dist/experience/workflow-template.js +4 -10
- package/dist/experience/workflow-template.js.map +1 -1
- package/dist/types/integration.d.ts +5 -2
- package/dist/types/integration.js.map +1 -1
- package/dist/types/workspace-target.d.ts +2 -3
- package/dist/types/workspace-target.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/experience/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/experience/runtime.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,yBAAyB,GAI1B,MAAM,SAAS,CAAC","sourcesContent":["/**\n * `@ekanos/sdk/experience/runtime` — the ONE seam between an experience and\n * an integration.\n *\n * An experience calls operations through an {@link ExperienceRuntime} and\n * through nothing else: no import of integration code, no `fetch` to an\n * integration route. The local harness implements it over its own\n * `/__ekanos/api/ops/run`; the host implements it over its experience route,\n * `/api/experiences/<experience>/slots/…?account=<team>`, with the team's own\n * connection to each integration (no install). Both answer with the same {@link OperationResult} and the same\n * refusal reasons, so an experience behaves identically in either.\n *\n * Isomorphic and dependency-free: types only (plus the re-exports below).\n */\nimport type { OperationResult } from '@ekanos/integration-schema';\n\nexport {\n OPERATION_REFUSAL_REASONS,\n type OperationError,\n type OperationRefusalReason,\n type OperationResult,\n} from './types';\n\n/** The channel a call arrives on; writes are judged by it (see `write_refused_on_channel`). */\nexport type OperationChannel = 'http' | 'rsc' | 'workflow';\n\n/**\n * Proof that a person approved one write. Opaque to the experience: the\n * runtime mints it (the harness approvals tray; the host approval gate) and\n * checks it. An experience may carry one back into `mutate(input, { approval })`.\n */\nexport interface ApprovalToken {\n readonly id: string;\n}\n\nexport interface OperationCallRequest {\n /** The integration name from `ekanos.json` `integrations` (its slug). */\n integration: string;\n /** `tool/<name>` or `action/<name>`. The version is the one `ekanos.json` pins. */\n op: string;\n input: unknown;\n channel: OperationChannel;\n approval?: ApprovalToken;\n}\n\nexport type IntegrationProvenance = 'registry' | 'local';\n\n/** What a runtime can say about an integration (for UI badges, never for widgets' logic). */\nexport interface IntegrationInfo {\n name: string;\n version: string;\n provenance: IntegrationProvenance;\n bindingMode?: string;\n runMode?: 'fixtures' | 'live';\n}\n\nexport interface ExperienceRuntime {\n /**\n * Run one operation. May take as long as a person takes to decide: a write\n * on an approval-gated channel resolves only once the approval tray has\n * answered (`write_not_approved` when it was rejected). Never throws for a\n * refusal: those are `{ ok: false, reason }`. A rejected promise means the\n * runtime itself is broken.\n */\n call(request: OperationCallRequest): Promise<OperationResult<unknown>>;\n integrations(): IntegrationInfo[];\n}\n"]}
|
|
@@ -93,6 +93,17 @@ export interface SerializeWorkflowOptions {
|
|
|
93
93
|
* a template can never name an operation the contract lacks.
|
|
94
94
|
*/
|
|
95
95
|
effectOf: (integration: string, op: string) => 'read' | 'write' | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* The experience's slug, written on every tool step as `experience`. The
|
|
98
|
+
* host resolves the running team's connection from it at run time.
|
|
99
|
+
*/
|
|
100
|
+
experience?: string;
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated Pass `experience`. Written on every tool step as
|
|
103
|
+
* `installationId` when `experience` is absent; with neither, steps carry
|
|
104
|
+
* the deprecated `TEMPLATE_INSTALLATION_ID` placeholder so a caller built
|
|
105
|
+
* against 0.21 keeps producing a valid template.
|
|
106
|
+
*/
|
|
96
107
|
installationId?: string;
|
|
97
108
|
}
|
|
98
109
|
/**
|
|
@@ -60,7 +60,9 @@ export { TEMPLATE_INSTALLATION_ID };
|
|
|
60
60
|
export function serializeWorkflowTemplate(template, options) {
|
|
61
61
|
var _a;
|
|
62
62
|
const steps = template.build();
|
|
63
|
-
const
|
|
63
|
+
const target = options.experience !== undefined
|
|
64
|
+
? { experience: options.experience }
|
|
65
|
+
: { installationId: (_a = options.installationId) !== null && _a !== void 0 ? _a : TEMPLATE_INSTALLATION_ID };
|
|
64
66
|
const where = `workflow template "${template.id}"`;
|
|
65
67
|
if (steps.length === 0)
|
|
66
68
|
throw new Error(`${where}: build() returned no steps.`);
|
|
@@ -91,15 +93,7 @@ export function serializeWorkflowTemplate(template, options) {
|
|
|
91
93
|
if (effect === undefined) {
|
|
92
94
|
throw new Error(`${where}: step "${s.id}" calls ${s.integration} ${s.op}, which the pinned contract does not declare.`);
|
|
93
95
|
}
|
|
94
|
-
return {
|
|
95
|
-
id: s.id,
|
|
96
|
-
type: 'fusion_tool',
|
|
97
|
-
tool: s.op,
|
|
98
|
-
installationId,
|
|
99
|
-
slot: s.integration,
|
|
100
|
-
args: s.args,
|
|
101
|
-
effect,
|
|
102
|
-
};
|
|
96
|
+
return Object.assign(Object.assign({ id: s.id, type: 'fusion_tool', tool: s.op }, target), { slot: s.integration, args: s.args, effect });
|
|
103
97
|
}
|
|
104
98
|
case 'ai':
|
|
105
99
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-template.js","sourceRoot":"","sources":["../../src/experience/workflow-template.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AAYpC,MAAM,UAAU,GAAG,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAE1E,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC;AA8CD,MAAM,OAAO,GAAG,CAAC,OAAgC,EAAE,EAAE,CACnD,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,MAAK,SAAS;IAC1B,CAAC,CAAC,EAAE;IACJ,CAAC,CAAC;QACE,KAAK,EACH,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;YAC/B,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;YACjB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;KACzB,CAAC;AAER;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,IAAI,CACF,EAAU,EACV,WAAc,EACd,EAAK,EACL,IAAoC,EACpC,OAAqB;QAErB,uBACE,IAAI,EAAE,MAAM,EACZ,EAAE;YACF,WAAW;YACX,EAAE,EACF,IAAI,EAAE,IAA+B,IAClC,OAAO,CAAC,OAAO,CAAC,EACnB;IACJ,CAAC;IACD,EAAE,CACA,EAAU,EACV,MAAwE,EACxE,OAAqB;;QAErB,uBACE,IAAI,EAAE,IAAI,EACV,EAAE,EACF,IAAI,QAAE,MAAM,CAAC,IAAI,mCAAI,OAAO,EAC5B,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,eAAe,EAAE,MAAM,CAAC,eAAe,IACpC,OAAO,CAAC,OAAO,CAAC,EACnB;IACJ,CAAC;IACD,QAAQ,CACN,EAAU,EACV,MAA+D,EAC/D,OAAqB;;QAErB,uBACE,IAAI,EAAE,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EAAE;oBACR,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,YAAY,EAAE,CAAC,CAAC,YAAY;oBAC5B,eAAe,EAAE,CAAC,CAAC,eAAe;iBACnC,CAAC;YACJ,KAAK,UAAU;gBACb,OAAO;oBACL,EAAE,EAAE,CAAC,CAAC,EAAE;oBACR,IAAI,EAAE,eAAe;oBACrB,eAAe,EAAE,CAAC,CAAC,OAAO;oBAC1B,aAAa,EAAE,CAAC,CAAC,aAAa;iBAC/B,CAAC;QACN,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,OAAO,EACL,QAAQ,CAAC,QAAQ,KAAK,SAAS;YAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;YACpB,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE;QACnD,KAAK,EAAE,QAAQ;QACf,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["import {\n TEMPLATE_INSTALLATION_ID,\n type WorkflowTemplate as EngineWorkflowTemplate,\n} from '@ekanos/integration-schema';\n\nimport type { OperationInput, OperationKey, IntegrationName } from './types';\n\n/**\n * A reference to an earlier step's output (`{ ref: 'draft.title' }`), the\n * workflow engine's operand shape. Build one with {@link ref}.\n */\nexport interface WorkflowRef {\n readonly ref: string;\n}\n\nexport function ref(path: string): WorkflowRef {\n if (path.trim() === '') throw new Error('ref(): path must not be empty.');\n\n return { ref: path };\n}\n\n/** Each input field may be literal or a reference to an earlier step's output. */\nexport type WithRefs<T> = T extends readonly unknown[]\n ? T | WorkflowRef\n : T extends object\n ? { [P in keyof T]: WithRefs<T[P]> | WorkflowRef }\n : T | WorkflowRef;\n\nexport interface StepOptions {\n /**\n * Step id(s) this step follows. Default: the previous step in `build()`\n * order (the first step follows nothing).\n */\n after?: string | readonly string[];\n}\n\nexport interface ToolStep {\n readonly type: 'tool';\n readonly id: string;\n readonly integration: string;\n /** `tool/<name>` or `action/<name>`; effect comes from the pinned contract. */\n readonly op: string;\n readonly args: Record<string, unknown>;\n readonly after?: readonly string[];\n}\n\nexport interface AiStep {\n readonly type: 'ai';\n readonly id: string;\n readonly kind: string;\n readonly instructions: string;\n readonly outputSchemaRef: string;\n readonly after?: readonly string[];\n}\n\nexport interface ApprovalStep {\n readonly type: 'approval';\n readonly id: string;\n readonly summary: string;\n readonly approverScope: 'account' | 'user';\n readonly after?: readonly string[];\n}\n\nexport type WorkflowStep = ToolStep | AiStep | ApprovalStep;\n\nconst afterOf = (options: StepOptions | undefined) =>\n options?.after === undefined\n ? {}\n : {\n after:\n typeof options.after === 'string'\n ? [options.after]\n : [...options.after],\n };\n\n/**\n * Step constructors for {@link defineWorkflowTemplate}.\n *\n * `step.tool` is typed from the generated registry: the integration, the operation\n * and its `args` are checked against the pinned contract. Whether a tool step\n * reads or writes is NOT authored; it is read from the contract at build, so a\n * template cannot call a write as if it were a read.\n */\nexport const step = {\n tool<S extends IntegrationName, K extends OperationKey<S>>(\n id: string,\n integration: S,\n op: K,\n args: WithRefs<OperationInput<S, K>>,\n options?: StepOptions,\n ): ToolStep {\n return {\n type: 'tool',\n id,\n integration,\n op,\n args: args as Record<string, unknown>,\n ...afterOf(options),\n };\n },\n ai(\n id: string,\n config: { instructions: string; outputSchemaRef: string; kind?: string },\n options?: StepOptions,\n ): AiStep {\n return {\n type: 'ai',\n id,\n kind: config.kind ?? 'draft',\n instructions: config.instructions,\n outputSchemaRef: config.outputSchemaRef,\n ...afterOf(options),\n };\n },\n approval(\n id: string,\n config: { summary: string; approverScope?: 'account' | 'user' },\n options?: StepOptions,\n ): ApprovalStep {\n return {\n type: 'approval',\n id,\n summary: config.summary,\n approverScope: config.approverScope ?? 'account',\n ...afterOf(options),\n };\n },\n};\n\nconst TEMPLATE_ID = /^[a-z][a-z0-9-]*$/;\nconst STEP_ID = /^[a-z][a-z0-9_]*$/;\nconst RESERVED_STEP_IDS = new Set(['trigger', 'item', 'loop', 'run']);\n\nexport interface WorkflowTemplateInput {\n /** kebab-case, unique within the experience. */\n id: string;\n name: string;\n /** A 5-field cron expression. Omit for a template that is started by hand. */\n schedule?: string;\n scope?: 'account' | 'user';\n /** Evaluated at `ekanos build`, never at runtime. */\n build: () => readonly WorkflowStep[];\n}\n\nexport interface WorkflowTemplate {\n readonly kind: 'workflow-template';\n readonly id: string;\n readonly name: string;\n readonly schedule?: string;\n readonly scope: 'account' | 'user';\n readonly build: () => readonly WorkflowStep[];\n}\n\nexport function defineWorkflowTemplate(\n input: WorkflowTemplateInput,\n): WorkflowTemplate {\n if (!TEMPLATE_ID.test(input.id)) {\n throw new Error(\n `defineWorkflowTemplate: id \"${input.id}\" must be kebab-case (e.g. \"morning-digest\").`,\n );\n }\n if (input.name.trim() === '') {\n throw new Error(`defineWorkflowTemplate(\"${input.id}\"): name is required.`);\n }\n if (\n input.schedule !== undefined &&\n input.schedule.trim().split(/\\s+/).length !== 5\n ) {\n throw new Error(\n `defineWorkflowTemplate(\"${input.id}\"): schedule must be a 5-field cron expression, got \"${input.schedule}\".`,\n );\n }\n\n return Object.freeze({\n kind: 'workflow-template' as const,\n id: input.id,\n name: input.name,\n ...(input.schedule === undefined ? {} : { schedule: input.schedule }),\n scope: input.scope ?? 'account',\n build: input.build,\n });\n}\n\n/** The serialized workflow the host's engine runs (validated by `WorkflowTemplateSchema`). */\nexport type WorkflowDsl = EngineWorkflowTemplate;\n\nexport { TEMPLATE_INSTALLATION_ID };\n\nexport interface SerializeWorkflowOptions {\n /**\n * Reads `read`/`write` for an integration operation from the pinned contract. Return\n * `undefined` when the operation is unknown: serialization then throws, so\n * a template can never name an operation the contract lacks.\n */\n effectOf: (integration: string, op: string) => 'read' | 'write' | undefined;\n installationId?: string;\n}\n\n/**\n * Turn a template into the engine's DSL. Pure and deterministic: the same\n * template and contracts always give the same JSON (it is hashed into the\n * manifest digest).\n */\nexport function serializeWorkflowTemplate(\n template: WorkflowTemplate,\n options: SerializeWorkflowOptions,\n): WorkflowDsl {\n const steps = template.build();\n const installationId = options.installationId ?? TEMPLATE_INSTALLATION_ID;\n const where = `workflow template \"${template.id}\"`;\n\n if (steps.length === 0)\n throw new Error(`${where}: build() returned no steps.`);\n\n const seen = new Set<string>();\n for (const s of steps) {\n if (!STEP_ID.test(s.id) || RESERVED_STEP_IDS.has(s.id)) {\n throw new Error(`${where}: step id \"${s.id}\" is invalid or reserved.`);\n }\n if (seen.has(s.id))\n throw new Error(`${where}: step id \"${s.id}\" is used twice.`);\n seen.add(s.id);\n }\n\n const edges: WorkflowDsl['edges'] = [];\n steps.forEach((s, index) => {\n const predecessors = s.after ?? (index === 0 ? [] : [steps[index - 1]!.id]);\n for (const from of predecessors) {\n if (!seen.has(from)) {\n throw new Error(\n `${where}: step \"${s.id}\" follows unknown step \"${from}\".`,\n );\n }\n edges.push({ from, to: s.id });\n }\n });\n\n const dslSteps = steps.map((s): WorkflowDsl['steps'][number] => {\n switch (s.type) {\n case 'tool': {\n const effect = options.effectOf(s.integration, s.op);\n if (effect === undefined) {\n throw new Error(\n `${where}: step \"${s.id}\" calls ${s.integration} ${s.op}, which the pinned contract does not declare.`,\n );\n }\n\n return {\n id: s.id,\n type: 'fusion_tool',\n tool: s.op,\n installationId,\n slot: s.integration,\n args: s.args as Extract<\n WorkflowDsl['steps'][number],\n { type: 'fusion_tool' }\n >['args'],\n effect,\n };\n }\n case 'ai':\n return {\n id: s.id,\n type: 'ai_step',\n kind: s.kind,\n instructions: s.instructions,\n outputSchemaRef: s.outputSchemaRef,\n };\n case 'approval':\n return {\n id: s.id,\n type: 'approval_gate',\n summaryTemplate: s.summary,\n approverScope: s.approverScope,\n };\n }\n });\n\n return {\n version: '1',\n name: template.name,\n scope: template.scope,\n trigger:\n template.schedule === undefined\n ? { type: 'manual' }\n : { type: 'schedule', cron: template.schedule },\n steps: dslSteps,\n edges,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"workflow-template.js","sourceRoot":"","sources":["../../src/experience/workflow-template.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AAYpC,MAAM,UAAU,GAAG,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAE1E,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC;AA8CD,MAAM,OAAO,GAAG,CAAC,OAAgC,EAAE,EAAE,CACnD,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,MAAK,SAAS;IAC1B,CAAC,CAAC,EAAE;IACJ,CAAC,CAAC;QACE,KAAK,EACH,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;YAC/B,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;YACjB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;KACzB,CAAC;AAER;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,IAAI,CACF,EAAU,EACV,WAAc,EACd,EAAK,EACL,IAAoC,EACpC,OAAqB;QAErB,uBACE,IAAI,EAAE,MAAM,EACZ,EAAE;YACF,WAAW;YACX,EAAE,EACF,IAAI,EAAE,IAA+B,IAClC,OAAO,CAAC,OAAO,CAAC,EACnB;IACJ,CAAC;IACD,EAAE,CACA,EAAU,EACV,MAAwE,EACxE,OAAqB;;QAErB,uBACE,IAAI,EAAE,IAAI,EACV,EAAE,EACF,IAAI,QAAE,MAAM,CAAC,IAAI,mCAAI,OAAO,EAC5B,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,eAAe,EAAE,MAAM,CAAC,eAAe,IACpC,OAAO,CAAC,OAAO,CAAC,EACnB;IACJ,CAAC;IACD,QAA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AAC,EAAE,IACP,MAAM,KACT,IAAI,EAAE,CAAC,CAAC,WAAW,EACnB,IAAI,EAAE,CAAC,CAAC,IAGC,EACT,MAAM,IACN;YACJ,CAAC;YACD,KAAK,IAAI;gBACP,OAAO;oBACL,EAAE,EAAE,CAAC,CAAC,EAAE;oBACR,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,YAAY,EAAE,CAAC,CAAC,YAAY;oBAC5B,eAAe,EAAE,CAAC,CAAC,eAAe;iBACnC,CAAC;YACJ,KAAK,UAAU;gBACb,OAAO;oBACL,EAAE,EAAE,CAAC,CAAC,EAAE;oBACR,IAAI,EAAE,eAAe;oBACrB,eAAe,EAAE,CAAC,CAAC,OAAO;oBAC1B,aAAa,EAAE,CAAC,CAAC,aAAa;iBAC/B,CAAC;QACN,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,OAAO,EACL,QAAQ,CAAC,QAAQ,KAAK,SAAS;YAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;YACpB,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE;QACnD,KAAK,EAAE,QAAQ;QACf,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["import {\n TEMPLATE_INSTALLATION_ID,\n type WorkflowTemplate as EngineWorkflowTemplate,\n} from '@ekanos/integration-schema';\n\nimport type { OperationInput, OperationKey, IntegrationName } from './types';\n\n/**\n * A reference to an earlier step's output (`{ ref: 'draft.title' }`), the\n * workflow engine's operand shape. Build one with {@link ref}.\n */\nexport interface WorkflowRef {\n readonly ref: string;\n}\n\nexport function ref(path: string): WorkflowRef {\n if (path.trim() === '') throw new Error('ref(): path must not be empty.');\n\n return { ref: path };\n}\n\n/** Each input field may be literal or a reference to an earlier step's output. */\nexport type WithRefs<T> = T extends readonly unknown[]\n ? T | WorkflowRef\n : T extends object\n ? { [P in keyof T]: WithRefs<T[P]> | WorkflowRef }\n : T | WorkflowRef;\n\nexport interface StepOptions {\n /**\n * Step id(s) this step follows. Default: the previous step in `build()`\n * order (the first step follows nothing).\n */\n after?: string | readonly string[];\n}\n\nexport interface ToolStep {\n readonly type: 'tool';\n readonly id: string;\n readonly integration: string;\n /** `tool/<name>` or `action/<name>`; effect comes from the pinned contract. */\n readonly op: string;\n readonly args: Record<string, unknown>;\n readonly after?: readonly string[];\n}\n\nexport interface AiStep {\n readonly type: 'ai';\n readonly id: string;\n readonly kind: string;\n readonly instructions: string;\n readonly outputSchemaRef: string;\n readonly after?: readonly string[];\n}\n\nexport interface ApprovalStep {\n readonly type: 'approval';\n readonly id: string;\n readonly summary: string;\n readonly approverScope: 'account' | 'user';\n readonly after?: readonly string[];\n}\n\nexport type WorkflowStep = ToolStep | AiStep | ApprovalStep;\n\nconst afterOf = (options: StepOptions | undefined) =>\n options?.after === undefined\n ? {}\n : {\n after:\n typeof options.after === 'string'\n ? [options.after]\n : [...options.after],\n };\n\n/**\n * Step constructors for {@link defineWorkflowTemplate}.\n *\n * `step.tool` is typed from the generated registry: the integration, the operation\n * and its `args` are checked against the pinned contract. Whether a tool step\n * reads or writes is NOT authored; it is read from the contract at build, so a\n * template cannot call a write as if it were a read.\n */\nexport const step = {\n tool<S extends IntegrationName, K extends OperationKey<S>>(\n id: string,\n integration: S,\n op: K,\n args: WithRefs<OperationInput<S, K>>,\n options?: StepOptions,\n ): ToolStep {\n return {\n type: 'tool',\n id,\n integration,\n op,\n args: args as Record<string, unknown>,\n ...afterOf(options),\n };\n },\n ai(\n id: string,\n config: { instructions: string; outputSchemaRef: string; kind?: string },\n options?: StepOptions,\n ): AiStep {\n return {\n type: 'ai',\n id,\n kind: config.kind ?? 'draft',\n instructions: config.instructions,\n outputSchemaRef: config.outputSchemaRef,\n ...afterOf(options),\n };\n },\n approval(\n id: string,\n config: { summary: string; approverScope?: 'account' | 'user' },\n options?: StepOptions,\n ): ApprovalStep {\n return {\n type: 'approval',\n id,\n summary: config.summary,\n approverScope: config.approverScope ?? 'account',\n ...afterOf(options),\n };\n },\n};\n\nconst TEMPLATE_ID = /^[a-z][a-z0-9-]*$/;\nconst STEP_ID = /^[a-z][a-z0-9_]*$/;\nconst RESERVED_STEP_IDS = new Set(['trigger', 'item', 'loop', 'run']);\n\nexport interface WorkflowTemplateInput {\n /** kebab-case, unique within the experience. */\n id: string;\n name: string;\n /** A 5-field cron expression. Omit for a template that is started by hand. */\n schedule?: string;\n scope?: 'account' | 'user';\n /** Evaluated at `ekanos build`, never at runtime. */\n build: () => readonly WorkflowStep[];\n}\n\nexport interface WorkflowTemplate {\n readonly kind: 'workflow-template';\n readonly id: string;\n readonly name: string;\n readonly schedule?: string;\n readonly scope: 'account' | 'user';\n readonly build: () => readonly WorkflowStep[];\n}\n\nexport function defineWorkflowTemplate(\n input: WorkflowTemplateInput,\n): WorkflowTemplate {\n if (!TEMPLATE_ID.test(input.id)) {\n throw new Error(\n `defineWorkflowTemplate: id \"${input.id}\" must be kebab-case (e.g. \"morning-digest\").`,\n );\n }\n if (input.name.trim() === '') {\n throw new Error(`defineWorkflowTemplate(\"${input.id}\"): name is required.`);\n }\n if (\n input.schedule !== undefined &&\n input.schedule.trim().split(/\\s+/).length !== 5\n ) {\n throw new Error(\n `defineWorkflowTemplate(\"${input.id}\"): schedule must be a 5-field cron expression, got \"${input.schedule}\".`,\n );\n }\n\n return Object.freeze({\n kind: 'workflow-template' as const,\n id: input.id,\n name: input.name,\n ...(input.schedule === undefined ? {} : { schedule: input.schedule }),\n scope: input.scope ?? 'account',\n build: input.build,\n });\n}\n\n/** The serialized workflow the host's engine runs (validated by `WorkflowTemplateSchema`). */\nexport type WorkflowDsl = EngineWorkflowTemplate;\n\nexport { TEMPLATE_INSTALLATION_ID };\n\nexport interface SerializeWorkflowOptions {\n /**\n * Reads `read`/`write` for an integration operation from the pinned contract. Return\n * `undefined` when the operation is unknown: serialization then throws, so\n * a template can never name an operation the contract lacks.\n */\n effectOf: (integration: string, op: string) => 'read' | 'write' | undefined;\n /**\n * The experience's slug, written on every tool step as `experience`. The\n * host resolves the running team's connection from it at run time.\n */\n experience?: string;\n /**\n * @deprecated Pass `experience`. Written on every tool step as\n * `installationId` when `experience` is absent; with neither, steps carry\n * the deprecated `TEMPLATE_INSTALLATION_ID` placeholder so a caller built\n * against 0.21 keeps producing a valid template.\n */\n installationId?: string;\n}\n\n/**\n * Turn a template into the engine's DSL. Pure and deterministic: the same\n * template and contracts always give the same JSON (it is hashed into the\n * manifest digest).\n */\nexport function serializeWorkflowTemplate(\n template: WorkflowTemplate,\n options: SerializeWorkflowOptions,\n): WorkflowDsl {\n const steps = template.build();\n const target =\n options.experience !== undefined\n ? { experience: options.experience }\n : { installationId: options.installationId ?? TEMPLATE_INSTALLATION_ID };\n const where = `workflow template \"${template.id}\"`;\n\n if (steps.length === 0)\n throw new Error(`${where}: build() returned no steps.`);\n\n const seen = new Set<string>();\n for (const s of steps) {\n if (!STEP_ID.test(s.id) || RESERVED_STEP_IDS.has(s.id)) {\n throw new Error(`${where}: step id \"${s.id}\" is invalid or reserved.`);\n }\n if (seen.has(s.id))\n throw new Error(`${where}: step id \"${s.id}\" is used twice.`);\n seen.add(s.id);\n }\n\n const edges: WorkflowDsl['edges'] = [];\n steps.forEach((s, index) => {\n const predecessors = s.after ?? (index === 0 ? [] : [steps[index - 1]!.id]);\n for (const from of predecessors) {\n if (!seen.has(from)) {\n throw new Error(\n `${where}: step \"${s.id}\" follows unknown step \"${from}\".`,\n );\n }\n edges.push({ from, to: s.id });\n }\n });\n\n const dslSteps = steps.map((s): WorkflowDsl['steps'][number] => {\n switch (s.type) {\n case 'tool': {\n const effect = options.effectOf(s.integration, s.op);\n if (effect === undefined) {\n throw new Error(\n `${where}: step \"${s.id}\" calls ${s.integration} ${s.op}, which the pinned contract does not declare.`,\n );\n }\n\n return {\n id: s.id,\n type: 'fusion_tool',\n tool: s.op,\n ...target,\n slot: s.integration,\n args: s.args as Extract<\n WorkflowDsl['steps'][number],\n { type: 'fusion_tool' }\n >['args'],\n effect,\n };\n }\n case 'ai':\n return {\n id: s.id,\n type: 'ai_step',\n kind: s.kind,\n instructions: s.instructions,\n outputSchemaRef: s.outputSchemaRef,\n };\n case 'approval':\n return {\n id: s.id,\n type: 'approval_gate',\n summaryTemplate: s.summary,\n approverScope: s.approverScope,\n };\n }\n });\n\n return {\n version: '1',\n name: template.name,\n scope: template.scope,\n trigger:\n template.schedule === undefined\n ? { type: 'manual' }\n : { type: 'schedule', cron: template.schedule },\n steps: dslSteps,\n edges,\n };\n}\n"]}
|
|
@@ -61,7 +61,10 @@ export type ActivationFormProps = IntegrationComponentProps & {
|
|
|
61
61
|
onSuccess?: (result: ActivationResult) => void;
|
|
62
62
|
onCancel?: () => void;
|
|
63
63
|
isLoading?: boolean;
|
|
64
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Every host renders a connect form inline in its own frame,
|
|
66
|
+
* and `ActivationForm` is always inline; a form can ignore this.
|
|
67
|
+
*/
|
|
65
68
|
inline?: boolean;
|
|
66
69
|
/**
|
|
67
70
|
* The integration is already connected and the person chose to connect it
|
|
@@ -140,7 +143,7 @@ export interface IntegrationMetadata {
|
|
|
140
143
|
* marketplace tile. Always declares its own top-level sidebar Section
|
|
141
144
|
* via `getSidebarNav()` and NEVER declares `getWorkspaceTargets()` —
|
|
142
145
|
* its widgets have no Workspace of their own, so an admin places them
|
|
143
|
-
* on one in the composer (`/admin/sources/[id]/
|
|
146
|
+
* on one in the composer (`/admin/sources/[id]/workspaces`).
|
|
144
147
|
* 'integration' — a connection to an outside system. Made available to a
|
|
145
148
|
* Source by a super-admin, then connected by a team or user (usually
|
|
146
149
|
* OAuth/SSO); has credentials, an activation flow and a marketplace
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/types/integration.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { IconRenderer } from './icon';\n\n// Capability shown on the integration detail page (numbered grid)\nexport interface IntegrationCapability {\n label: string;\n description: string;\n icon?: IconRenderer;\n}\n\n// Permission scope shown on the integration detail page\nexport interface IntegrationPermission {\n label: string;\n detail: string;\n type: 'read' | 'write';\n}\n\n// ---- Integration Health Monitoring (issue #474) -----------------------------\n\n// Higher = healthier. Used internally for \"least healthy wins\" merging.\nexport type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';\n\n/**\n * Result returned by `BaseIntegration.healthCheck(accountId)`. Routed through\n * `classifyHealth()` (server-side) before writing to\n * `integration_health_status`.\n */\nexport interface HealthCheckResult {\n status: HealthStatus;\n errorCode?: string;\n errorMessage?: string;\n /** Rolling 24h error rate from `account_product_usage_events`, 0..100. */\n errorRatePct?: number;\n /** Sample size used to compute errorRatePct; if below threshold, treated as unknown. */\n sampleSize?: number;\n /** Whether the most recent observed call succeeded. */\n lastObservationSucceeded?: boolean;\n /** Token/credential expiry, if known. Drives token-expiry warnings. */\n tokenExpiresAt?: string;\n /** Free-form per-integration data carried to the dashboard. */\n metadata?: Record<string, unknown>;\n}\n\n// Activation result from integration\nexport interface ActivationResult {\n success: boolean;\n configData?: Record<string, unknown>;\n externalId?: string;\n errorMessage?: string;\n metadata?: Record<string, unknown>;\n}\n\n// Base props that all integration components need\ninterface BaseIntegrationComponentProps {\n accountId: string;\n sourceId?: string;\n integrationConfig?: Record<string, unknown>;\n}\n\n// Discriminated union for product reference - only one allowed\ntype ProductReference =\n | { productId: string; productSlug?: never }\n | { productSlug: string; productId?: never };\n\n// New base type using discriminated union\nexport type IntegrationComponentProps = BaseIntegrationComponentProps &\n ProductReference;\n\n// Marketplace tile props\nexport type MarketplaceTileProps = IntegrationComponentProps & {\n onActivate?: () => void;\n isActivated?: boolean;\n /** Navigation URL for the integration detail page */\n href?: string;\n};\n\n// Activation form props\nexport type ActivationFormProps = IntegrationComponentProps & {\n onSuccess?: (result: ActivationResult) => void;\n onCancel?: () => void;\n isLoading?: boolean;\n /** Render inline instead of in a dialog */\n inline?: boolean;\n /**\n * The integration is already connected and the person chose to connect it\n * again — after a token expired, a password changed, or a health check\n * failed. An OAuth form sends them through sign-in even when a token is\n * stored; a credential form simply accepts new values. Activating again\n * resets the integration's health to unknown until the next check.\n */\n reconnect?: boolean;\n /**\n * The TEAM account context the user is activating within — separate from\n * `accountId`, which for `scope: 'user'` integrations is collapsed to the\n * personal account for activation storage/token purposes. Only consumed by\n * workspace materialization (`materializeWorkspaceOnActivation`), never for\n * activation/token storage itself (plan 009 Part A2). Optional: undefined\n * for team-scoped integrations (their `accountId` already IS the team) and\n * for any caller that hasn't threaded it yet — the server action falls back\n * to `accountId` when absent.\n */\n teamAccountId?: string;\n};\n\n// Integration metadata\nexport interface IntegrationMetadata {\n productId: string;\n productSlug: string;\n integrationName: string;\n description: string;\n category: string;\n version: string;\n icon?: string;\n /** Bundled logo URL — overrides product.logo_path on the marketplace */\n logoPath?: string;\n /** When 'user', activation data is stored under the user's personal account (user.id) instead of the team account */\n scope?: 'user' | 'team';\n /**\n * Set FALSE to assert this integration has NO self-serve activation surface —\n * the marketplace detail page then renders no activation form at all.\n *\n * This is deliberately distinct from \"has no CUSTOM activation form\": an\n * integration that omits `getActivationForm()` still gets the generic one, and\n * six integrations depend on that. Use this flag only when submitting ANY\n * activation form would be a dead end — where `activate()` cannot succeed, so\n * showing a form hands the user a button that cannot work.\n * Undefined/true = normal self-serve activation.\n */\n selfServeActivation?: boolean;\n /**\n * How this integration's MCP tools resolve credentials — the integration's\n * SELF-DECLARATION of machine-executability, consumed dynamically by the\n * workflow engine's fail-closed tool allowlist (isGatewayExposableTool).\n *\n * 'account' — credentials/identity resolve from team- or source-level\n * config via the ToolContext (`getAccountId(ctx)` + `ctx.supabase`).\n * Safe for durable machine-principal execution (workflows): eligible\n * tools (read + public/internal sensitivity) become workflow-callable.\n * 'user' — credentials or identity are personal (ctx.user.id, personal\n * OAuth, session reads like getSupabaseServerClient()/requireUser()).\n * NEVER machine-executable: a workflow would silently ride one\n * employee's personal grant.\n * 'source' — platform-level credentials (diagnostics-class integrations).\n * Not exposed to account workflows.\n *\n * UNDECLARED = fail closed (treated as not machine-executable). Declaring\n * 'account' is a security assertion: the integration's MCP run() handlers\n * must use ctx-based resolution ONLY — no session clients, no personal\n * grants. A guard test in @kit/integrations-workflows enforces the obvious\n * violations (session-client reads in mcp/ code of 'account' declarers).\n */\n credentialModel?: 'account' | 'user' | 'source';\n /**\n * Which KIND of integration this is. **Required** — nothing is inferred from\n * omission. An Integration is any package extending `BaseIntegration`; its\n * kind says who turns it on and whether it needs credentials:\n *\n * 'feature' — an Ekanos-native capability. Enabled for a Source by a\n * super-admin; no third-party credentials, no activation flow, no\n * marketplace tile. Always declares its own top-level sidebar Section\n * via `getSidebarNav()` and NEVER declares `getWorkspaceTargets()` —\n * its widgets have no Workspace of their own, so an admin places them\n * on one in the composer (`/admin/sources/[id]/layout`).\n * 'integration' — a connection to an outside system. Made available to a\n * Source by a super-admin, then connected by a team or user (usually\n * OAuth/SSO); has credentials, an activation flow and a marketplace\n * tile. Declares a Workspace via `getWorkspaceTargets()`, a top-level\n * Section via `getSidebarNav()`, or both (Centrex does both).\n *\n * The asymmetry is one-directional and enforced by the host's CI:\n * a Feature MUST declare a Section and MUST NOT declare a Workspace; a\n * connector MAY declare either or both.\n */\n kind: 'feature' | 'integration';\n /**\n * Product slugs that MUST be attached to the same Source for this product to\n * function — a hard dependency, not a suggestion.\n *\n * The host REFUSES to attach this product to a Source missing any of them,\n * and refuses a detach that would strand a dependent. Admin surfaces render\n * the dependency in both directions (\"Requires X\" / \"Enables Y\").\n *\n * Host CI enforces: every slug is registered, nothing requires itself, no\n * cycles, and a `kind: 'feature'` may require a `'integration'` but never\n * the reverse.\n */\n requires?: string[];\n}\n\n// Widget configuration\nexport interface WidgetConfig {\n id: string;\n name: string;\n component: ComponentType<IntegrationComponentProps>;\n gridSize?: { cols: number; rows: number } | { cols: number; rows: number }[];\n gridPosition?: { col: number; row: number };\n widgetState: 'active' | 'inactive' | 'disabled';\n /**\n * `compact` (a figure tile, 1 → 2 → 4 across its row), `half` or `full`\n * (the design system's widget rules). Unset, it is derived from `layouts.lg.w`.\n */\n size?: 'compact' | 'half' | 'full';\n // React-grid-layout format\n layouts?: {\n lg?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n md?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n sm?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n };\n // Integration metadata for widgets\n integrationMetadata?: IntegrationMetadata;\n category?: { id: string; name: string; slug: string; icon: string | null };\n // Database product ID (UUID) from widget_config table\n productId?: string;\n isCollapsible?: boolean;\n // For collapsed state persistence\n collapsed?: boolean;\n widgetConfigId?: string;\n // Resolved workspace placement (explicit widget_config.workspace_id\n // override, else the product's inheriting attachment). Populated by the\n // dashboard widgets loader; null = no workspace (unscoped dashboard).\n workspaceId?: string | null;\n isPinnable?: boolean;\n isPinned?: boolean;\n // When true, the dashboard renders the \"Ask about this\" AI footer bar for\n // this widget. The widget may still pass `askContext` to the wrapper for a\n // rich snapshot; otherwise a minimal default is used.\n aiFooterEnabled?: boolean;\n // Integration health for this widget's product. `unhealthy` downgrades the\n // widget to `disabled`; `degraded` surfaces a stale-data footer.\n health?: {\n status: HealthStatus;\n lastSuccessAt?: string | null;\n errorMessage?: string | null;\n };\n}\n\n// Database types for integration tables.\n//\n// PARTNER-VISIBLE SUBSET: these row types deliberately OMIT `vault_secret_id`.\n// A vault id is a host handle to a decryptable secret; the partner surface\n// never exposes one — `ctx.secrets` fences it off. Host code keeps the full\n// row because it needs the handle; a parity test pins the SDK type as the\n// host's row minus exactly the host-only fields, so a new column cannot drift\n// in here unnoticed.\nexport interface IntegrationConfig {\n id: string;\n account_id: string | null;\n product_id: string;\n config_type: 'api_credentials' | 'activation_data' | 'settings';\n config_data: Record<string, unknown>;\n status: 'active' | 'inactive' | 'pending' | 'error' | 'suspended';\n is_active: boolean;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n\n/**\n * The PARTNER-VISIBLE `data_type` values on `account_product_data` — a strict\n * SUBSET of `@kit/integrations-core`'s union.\n *\n * `'secret'` is deliberately absent. Secret rows are host-managed (one row per\n * secret name, value in Vault, `vault_secret_id` on the row), written only by\n * the capability context's `persistSecret` and read only through\n * `ctx.secrets`. Naming the kind here would advertise a row shape partner code\n * must never address: `ctx.storage` rejects it, and core's generic accessors\n * reject it too (`config-utils.ts`, `assertNotHostOnlyDataType`) precisely\n * because a write there would land the plaintext in the `data` column.\n *\n * When you add an integration-specific kind, add it in BOTH places (core owns\n * the full union) and keep this one partner-appropriate. Prefer `dataSubtype`\n * for orthogonal slicing within a kind (e.g. `data_type='cache'`,\n * `data_subtype='profile'`); reserve a new top-level kind for data that has a\n * distinct lifecycle or is queried independently.\n */\nexport type AccountProductDataType =\n | 'activation'\n | 'settings'\n | 'metrics_summary'\n | 'sync_state'\n | 'cache'\n // Integration-specific kinds — extend here when needed.\n | 'cash_forecast' // quickbooks — user-supplied manual cash-forecast estimates\n | 'tax_config'; // quickbooks — per-user federal/state tax rate config\n\nexport interface AccountProductData {\n id: string;\n account_id: string;\n product_id: string;\n data_type: AccountProductDataType;\n data_subtype?: string;\n data: Record<string, unknown>;\n expires_at?: string;\n integration_config_id?: string;\n external_id?: string;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/types/integration.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { IconRenderer } from './icon';\n\n// Capability shown on the integration detail page (numbered grid)\nexport interface IntegrationCapability {\n label: string;\n description: string;\n icon?: IconRenderer;\n}\n\n// Permission scope shown on the integration detail page\nexport interface IntegrationPermission {\n label: string;\n detail: string;\n type: 'read' | 'write';\n}\n\n// ---- Integration Health Monitoring (issue #474) -----------------------------\n\n// Higher = healthier. Used internally for \"least healthy wins\" merging.\nexport type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';\n\n/**\n * Result returned by `BaseIntegration.healthCheck(accountId)`. Routed through\n * `classifyHealth()` (server-side) before writing to\n * `integration_health_status`.\n */\nexport interface HealthCheckResult {\n status: HealthStatus;\n errorCode?: string;\n errorMessage?: string;\n /** Rolling 24h error rate from `account_product_usage_events`, 0..100. */\n errorRatePct?: number;\n /** Sample size used to compute errorRatePct; if below threshold, treated as unknown. */\n sampleSize?: number;\n /** Whether the most recent observed call succeeded. */\n lastObservationSucceeded?: boolean;\n /** Token/credential expiry, if known. Drives token-expiry warnings. */\n tokenExpiresAt?: string;\n /** Free-form per-integration data carried to the dashboard. */\n metadata?: Record<string, unknown>;\n}\n\n// Activation result from integration\nexport interface ActivationResult {\n success: boolean;\n configData?: Record<string, unknown>;\n externalId?: string;\n errorMessage?: string;\n metadata?: Record<string, unknown>;\n}\n\n// Base props that all integration components need\ninterface BaseIntegrationComponentProps {\n accountId: string;\n sourceId?: string;\n integrationConfig?: Record<string, unknown>;\n}\n\n// Discriminated union for product reference - only one allowed\ntype ProductReference =\n | { productId: string; productSlug?: never }\n | { productSlug: string; productId?: never };\n\n// New base type using discriminated union\nexport type IntegrationComponentProps = BaseIntegrationComponentProps &\n ProductReference;\n\n// Marketplace tile props\nexport type MarketplaceTileProps = IntegrationComponentProps & {\n onActivate?: () => void;\n isActivated?: boolean;\n /** Navigation URL for the integration detail page */\n href?: string;\n};\n\n// Activation form props\nexport type ActivationFormProps = IntegrationComponentProps & {\n onSuccess?: (result: ActivationResult) => void;\n onCancel?: () => void;\n isLoading?: boolean;\n /**\n * @deprecated Every host renders a connect form inline in its own frame,\n * and `ActivationForm` is always inline; a form can ignore this.\n */\n inline?: boolean;\n /**\n * The integration is already connected and the person chose to connect it\n * again — after a token expired, a password changed, or a health check\n * failed. An OAuth form sends them through sign-in even when a token is\n * stored; a credential form simply accepts new values. Activating again\n * resets the integration's health to unknown until the next check.\n */\n reconnect?: boolean;\n /**\n * The TEAM account context the user is activating within — separate from\n * `accountId`, which for `scope: 'user'` integrations is collapsed to the\n * personal account for activation storage/token purposes. Only consumed by\n * workspace materialization (`materializeWorkspaceOnActivation`), never for\n * activation/token storage itself (plan 009 Part A2). Optional: undefined\n * for team-scoped integrations (their `accountId` already IS the team) and\n * for any caller that hasn't threaded it yet — the server action falls back\n * to `accountId` when absent.\n */\n teamAccountId?: string;\n};\n\n// Integration metadata\nexport interface IntegrationMetadata {\n productId: string;\n productSlug: string;\n integrationName: string;\n description: string;\n category: string;\n version: string;\n icon?: string;\n /** Bundled logo URL — overrides product.logo_path on the marketplace */\n logoPath?: string;\n /** When 'user', activation data is stored under the user's personal account (user.id) instead of the team account */\n scope?: 'user' | 'team';\n /**\n * Set FALSE to assert this integration has NO self-serve activation surface —\n * the marketplace detail page then renders no activation form at all.\n *\n * This is deliberately distinct from \"has no CUSTOM activation form\": an\n * integration that omits `getActivationForm()` still gets the generic one, and\n * six integrations depend on that. Use this flag only when submitting ANY\n * activation form would be a dead end — where `activate()` cannot succeed, so\n * showing a form hands the user a button that cannot work.\n * Undefined/true = normal self-serve activation.\n */\n selfServeActivation?: boolean;\n /**\n * How this integration's MCP tools resolve credentials — the integration's\n * SELF-DECLARATION of machine-executability, consumed dynamically by the\n * workflow engine's fail-closed tool allowlist (isGatewayExposableTool).\n *\n * 'account' — credentials/identity resolve from team- or source-level\n * config via the ToolContext (`getAccountId(ctx)` + `ctx.supabase`).\n * Safe for durable machine-principal execution (workflows): eligible\n * tools (read + public/internal sensitivity) become workflow-callable.\n * 'user' — credentials or identity are personal (ctx.user.id, personal\n * OAuth, session reads like getSupabaseServerClient()/requireUser()).\n * NEVER machine-executable: a workflow would silently ride one\n * employee's personal grant.\n * 'source' — platform-level credentials (diagnostics-class integrations).\n * Not exposed to account workflows.\n *\n * UNDECLARED = fail closed (treated as not machine-executable). Declaring\n * 'account' is a security assertion: the integration's MCP run() handlers\n * must use ctx-based resolution ONLY — no session clients, no personal\n * grants. A guard test in @kit/integrations-workflows enforces the obvious\n * violations (session-client reads in mcp/ code of 'account' declarers).\n */\n credentialModel?: 'account' | 'user' | 'source';\n /**\n * Which KIND of integration this is. **Required** — nothing is inferred from\n * omission. An Integration is any package extending `BaseIntegration`; its\n * kind says who turns it on and whether it needs credentials:\n *\n * 'feature' — an Ekanos-native capability. Enabled for a Source by a\n * super-admin; no third-party credentials, no activation flow, no\n * marketplace tile. Always declares its own top-level sidebar Section\n * via `getSidebarNav()` and NEVER declares `getWorkspaceTargets()` —\n * its widgets have no Workspace of their own, so an admin places them\n * on one in the composer (`/admin/sources/[id]/workspaces`).\n * 'integration' — a connection to an outside system. Made available to a\n * Source by a super-admin, then connected by a team or user (usually\n * OAuth/SSO); has credentials, an activation flow and a marketplace\n * tile. Declares a Workspace via `getWorkspaceTargets()`, a top-level\n * Section via `getSidebarNav()`, or both (Centrex does both).\n *\n * The asymmetry is one-directional and enforced by the host's CI:\n * a Feature MUST declare a Section and MUST NOT declare a Workspace; a\n * connector MAY declare either or both.\n */\n kind: 'feature' | 'integration';\n /**\n * Product slugs that MUST be attached to the same Source for this product to\n * function — a hard dependency, not a suggestion.\n *\n * The host REFUSES to attach this product to a Source missing any of them,\n * and refuses a detach that would strand a dependent. Admin surfaces render\n * the dependency in both directions (\"Requires X\" / \"Enables Y\").\n *\n * Host CI enforces: every slug is registered, nothing requires itself, no\n * cycles, and a `kind: 'feature'` may require a `'integration'` but never\n * the reverse.\n */\n requires?: string[];\n}\n\n// Widget configuration\nexport interface WidgetConfig {\n id: string;\n name: string;\n component: ComponentType<IntegrationComponentProps>;\n gridSize?: { cols: number; rows: number } | { cols: number; rows: number }[];\n gridPosition?: { col: number; row: number };\n widgetState: 'active' | 'inactive' | 'disabled';\n /**\n * `compact` (a figure tile, 1 → 2 → 4 across its row), `half` or `full`\n * (the design system's widget rules). Unset, it is derived from `layouts.lg.w`.\n */\n size?: 'compact' | 'half' | 'full';\n // React-grid-layout format\n layouts?: {\n lg?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n md?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n sm?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n };\n // Integration metadata for widgets\n integrationMetadata?: IntegrationMetadata;\n category?: { id: string; name: string; slug: string; icon: string | null };\n // Database product ID (UUID) from widget_config table\n productId?: string;\n isCollapsible?: boolean;\n // For collapsed state persistence\n collapsed?: boolean;\n widgetConfigId?: string;\n // Resolved workspace placement (explicit widget_config.workspace_id\n // override, else the product's inheriting attachment). Populated by the\n // dashboard widgets loader; null = no workspace (unscoped dashboard).\n workspaceId?: string | null;\n isPinnable?: boolean;\n isPinned?: boolean;\n // When true, the dashboard renders the \"Ask about this\" AI footer bar for\n // this widget. The widget may still pass `askContext` to the wrapper for a\n // rich snapshot; otherwise a minimal default is used.\n aiFooterEnabled?: boolean;\n // Integration health for this widget's product. `unhealthy` downgrades the\n // widget to `disabled`; `degraded` surfaces a stale-data footer.\n health?: {\n status: HealthStatus;\n lastSuccessAt?: string | null;\n errorMessage?: string | null;\n };\n}\n\n// Database types for integration tables.\n//\n// PARTNER-VISIBLE SUBSET: these row types deliberately OMIT `vault_secret_id`.\n// A vault id is a host handle to a decryptable secret; the partner surface\n// never exposes one — `ctx.secrets` fences it off. Host code keeps the full\n// row because it needs the handle; a parity test pins the SDK type as the\n// host's row minus exactly the host-only fields, so a new column cannot drift\n// in here unnoticed.\nexport interface IntegrationConfig {\n id: string;\n account_id: string | null;\n product_id: string;\n config_type: 'api_credentials' | 'activation_data' | 'settings';\n config_data: Record<string, unknown>;\n status: 'active' | 'inactive' | 'pending' | 'error' | 'suspended';\n is_active: boolean;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n\n/**\n * The PARTNER-VISIBLE `data_type` values on `account_product_data` — a strict\n * SUBSET of `@kit/integrations-core`'s union.\n *\n * `'secret'` is deliberately absent. Secret rows are host-managed (one row per\n * secret name, value in Vault, `vault_secret_id` on the row), written only by\n * the capability context's `persistSecret` and read only through\n * `ctx.secrets`. Naming the kind here would advertise a row shape partner code\n * must never address: `ctx.storage` rejects it, and core's generic accessors\n * reject it too (`config-utils.ts`, `assertNotHostOnlyDataType`) precisely\n * because a write there would land the plaintext in the `data` column.\n *\n * When you add an integration-specific kind, add it in BOTH places (core owns\n * the full union) and keep this one partner-appropriate. Prefer `dataSubtype`\n * for orthogonal slicing within a kind (e.g. `data_type='cache'`,\n * `data_subtype='profile'`); reserve a new top-level kind for data that has a\n * distinct lifecycle or is queried independently.\n */\nexport type AccountProductDataType =\n | 'activation'\n | 'settings'\n | 'metrics_summary'\n | 'sync_state'\n | 'cache'\n // Integration-specific kinds — extend here when needed.\n | 'cash_forecast' // quickbooks — user-supplied manual cash-forecast estimates\n | 'tax_config'; // quickbooks — per-user federal/state tax rate config\n\nexport interface AccountProductData {\n id: string;\n account_id: string;\n product_id: string;\n data_type: AccountProductDataType;\n data_subtype?: string;\n data: Record<string, unknown>;\n expires_at?: string;\n integration_config_id?: string;\n external_id?: string;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n"]}
|
|
@@ -16,9 +16,8 @@ export interface WorkspaceTargetDefinition {
|
|
|
16
16
|
* alphanumeric with single hyphens between segments. */
|
|
17
17
|
slug: string;
|
|
18
18
|
name: string;
|
|
19
|
-
/** A Font Awesome class string, e.g. `fa-inbox`.
|
|
20
|
-
*
|
|
21
|
-
* not be written. Validated by the host at gate time. */
|
|
19
|
+
/** A Font Awesome class string, e.g. `fa-inbox`. Validated by the host at
|
|
20
|
+
* gate time. */
|
|
22
21
|
icon?: string;
|
|
23
22
|
description?: string;
|
|
24
23
|
/** Defaults to `'masonry'` when omitted. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-target.js","sourceRoot":"","sources":["../../src/types/workspace-target.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The contract an integration uses to declare the workspaces it ships with\n * (`BaseIntegration.getWorkspaceTargets()`).\n *\n * The host's canonical definition is `z.input<typeof WorkspaceTargetSchema>`\n * (`@kit/integrations-core`, `schemas/workspace-target.schema.ts`) — the\n * schema validates declarations in CI and at materialization time, including\n * cross-field rules a type cannot carry (icon-name validity, slug format,\n * `inheritsWidgets`/`includedWidgetIds` exclusivity, one inheriting target\n * per set). This structural twin exists so the SDK's root entrypoint owns its\n * types without importing the host schema; the parity test beside these types\n * keeps the two shapes mutually assignable.\n */\nexport interface WorkspaceTargetDefinition {\n /** Stable URL segment — `/workspace/<slug>` routes reference it. Lowercase\n * alphanumeric with single hyphens between segments. */\n slug: string;\n name: string;\n /** A Font Awesome class string, e.g. `fa-inbox`.
|
|
1
|
+
{"version":3,"file":"workspace-target.js","sourceRoot":"","sources":["../../src/types/workspace-target.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The contract an integration uses to declare the workspaces it ships with\n * (`BaseIntegration.getWorkspaceTargets()`).\n *\n * The host's canonical definition is `z.input<typeof WorkspaceTargetSchema>`\n * (`@kit/integrations-core`, `schemas/workspace-target.schema.ts`) — the\n * schema validates declarations in CI and at materialization time, including\n * cross-field rules a type cannot carry (icon-name validity, slug format,\n * `inheritsWidgets`/`includedWidgetIds` exclusivity, one inheriting target\n * per set). This structural twin exists so the SDK's root entrypoint owns its\n * types without importing the host schema; the parity test beside these types\n * keeps the two shapes mutually assignable.\n */\nexport interface WorkspaceTargetDefinition {\n /** Stable URL segment — `/workspace/<slug>` routes reference it. Lowercase\n * alphanumeric with single hyphens between segments. */\n slug: string;\n name: string;\n /** A Font Awesome class string, e.g. `fa-inbox`. Validated by the host at\n * gate time. */\n icon?: string;\n description?: string;\n /** Defaults to `'masonry'` when omitted. */\n layout?: 'masonry' | 'two-column';\n /**\n * Whether this workspace receives the product's otherwise-unplaced\n * widgets. Exactly one target per product must set it; mutually exclusive\n * with `includedWidgetIds`.\n */\n inheritsWidgets?: boolean;\n /** Limit this workspace to specific widget ids. */\n includedWidgetIds?: string[];\n /**\n * Create this workspace on a Source as soon as the product is made\n * available there, instead of waiting for an admin to add it. Only for a\n * product that works as shipped (`activation: { required: false }`).\n */\n materializeOnEntitlement?: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekanos/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The official SDK for building Ekanos integrations.",
|
|
6
6
|
"homepage": "https://sdk.ekanos.dev/sdk/overview",
|
|
@@ -114,29 +114,29 @@
|
|
|
114
114
|
"access": "public"
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@ekanos/integration-schema": "0.
|
|
118
|
-
"@ekanos/ui": "0.
|
|
117
|
+
"@ekanos/integration-schema": "0.23.0",
|
|
118
|
+
"@ekanos/ui": "0.23.0",
|
|
119
119
|
"@supabase/supabase-js": "2.118.0",
|
|
120
120
|
"server-only": "^0.0.1",
|
|
121
121
|
"zod-to-json-schema": "3.25.2"
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@hookform/resolvers": "^
|
|
124
|
+
"@hookform/resolvers": "^7.0.1",
|
|
125
125
|
"@kit/tsconfig": "0.1.0",
|
|
126
|
-
"@tanstack/react-query": "5.
|
|
126
|
+
"@tanstack/react-query": "5.105.3",
|
|
127
127
|
"@types/react": "19.3.0",
|
|
128
128
|
"@types/react-dom": "19.3.0",
|
|
129
|
-
"eslint": "^10.
|
|
130
|
-
"next": "16.4.
|
|
129
|
+
"eslint": "^10.14.0",
|
|
130
|
+
"next": "16.4.4",
|
|
131
131
|
"react": "19.3.1",
|
|
132
132
|
"react-dom": "19.3.1",
|
|
133
|
-
"react-hook-form": "^7.
|
|
133
|
+
"react-hook-form": "^7.91.0",
|
|
134
134
|
"typescript": "^7.0.2",
|
|
135
|
-
"vitest": "
|
|
135
|
+
"vitest": "5.1.0",
|
|
136
136
|
"zod": "4.6.7"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
|
-
"@hookform/resolvers": "^5.2.2",
|
|
139
|
+
"@hookform/resolvers": "^5.2.2 || ^7.0.0",
|
|
140
140
|
"@tanstack/react-query": "^5.101.4",
|
|
141
141
|
"next": "^16.0.0",
|
|
142
142
|
"react": "^19.2.8",
|