@octonodes/sdk 0.0.3 → 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 (69) hide show
  1. package/PLUGINS.md +128 -0
  2. package/README.md +107 -9
  3. package/dist/gen/index.d.ts +2 -2
  4. package/dist/gen/index.d.ts.map +1 -1
  5. package/dist/gen/index.js +4 -3
  6. package/dist/gen/index.js.map +1 -1
  7. package/dist/gen/sdk.gen.d.ts +9 -1
  8. package/dist/gen/sdk.gen.d.ts.map +1 -1
  9. package/dist/gen/sdk.gen.js +21 -3
  10. package/dist/gen/sdk.gen.js.map +1 -1
  11. package/dist/gen/types.gen.d.ts +230 -0
  12. package/dist/gen/types.gen.d.ts.map +1 -1
  13. package/dist/plugins/index.d.ts +2 -0
  14. package/dist/plugins/index.d.ts.map +1 -0
  15. package/dist/plugins/index.js +19 -0
  16. package/dist/plugins/index.js.map +1 -0
  17. package/dist/plugins/schema/constants.d.ts +33 -0
  18. package/dist/plugins/schema/constants.d.ts.map +1 -0
  19. package/dist/plugins/schema/constants.js +207 -0
  20. package/dist/plugins/schema/constants.js.map +1 -0
  21. package/dist/plugins/schema/icons.d.ts +5 -0
  22. package/dist/plugins/schema/icons.d.ts.map +1 -0
  23. package/dist/plugins/schema/icons.js +62 -0
  24. package/dist/plugins/schema/icons.js.map +1 -0
  25. package/dist/plugins/schema/ipc-envelope.d.ts +923 -0
  26. package/dist/plugins/schema/ipc-envelope.d.ts.map +1 -0
  27. package/dist/plugins/schema/ipc-envelope.js +210 -0
  28. package/dist/plugins/schema/ipc-envelope.js.map +1 -0
  29. package/dist/plugins/schema/plugin-sdk/index.d.ts +5 -0
  30. package/dist/plugins/schema/plugin-sdk/index.d.ts.map +1 -0
  31. package/dist/plugins/schema/plugin-sdk/index.js +25 -0
  32. package/dist/plugins/schema/plugin-sdk/index.js.map +1 -0
  33. package/dist/plugins/schema/plugin.d.ts +662 -0
  34. package/dist/plugins/schema/plugin.d.ts.map +1 -0
  35. package/dist/plugins/schema/plugin.js +144 -0
  36. package/dist/plugins/schema/plugin.js.map +1 -0
  37. package/dist/plugins/sdk/define-node.d.ts +103 -0
  38. package/dist/plugins/sdk/define-node.d.ts.map +1 -0
  39. package/dist/plugins/sdk/define-node.js +58 -0
  40. package/dist/plugins/sdk/define-node.js.map +1 -0
  41. package/dist/plugins/sdk/json-schema.d.ts +17 -0
  42. package/dist/plugins/sdk/json-schema.d.ts.map +1 -0
  43. package/dist/plugins/sdk/json-schema.js +79 -0
  44. package/dist/plugins/sdk/json-schema.js.map +1 -0
  45. package/dist/plugins/sdk/plugin.d.ts +7 -0
  46. package/dist/plugins/sdk/plugin.d.ts.map +1 -0
  47. package/dist/plugins/sdk/plugin.js +74 -0
  48. package/dist/plugins/sdk/plugin.js.map +1 -0
  49. package/dist/plugins/sdk/plugin.types.d.ts +15 -0
  50. package/dist/plugins/sdk/plugin.types.d.ts.map +1 -0
  51. package/dist/plugins/sdk/plugin.types.js +3 -0
  52. package/dist/plugins/sdk/plugin.types.js.map +1 -0
  53. package/dist/plugins/sdk/plugins/define-node.d.ts +29 -0
  54. package/dist/plugins/sdk/plugins/define-node.d.ts.map +1 -0
  55. package/dist/plugins/sdk/plugins/define-node.js +16 -0
  56. package/dist/plugins/sdk/plugins/define-node.js.map +1 -0
  57. package/dist/plugins/sdk/plugins/index.d.ts +10 -0
  58. package/dist/plugins/sdk/plugins/index.d.ts.map +1 -0
  59. package/dist/plugins/sdk/plugins/index.js +23 -0
  60. package/dist/plugins/sdk/plugins/index.js.map +1 -0
  61. package/dist/plugins/sdk/plugins/types.d.ts +34 -0
  62. package/dist/plugins/sdk/plugins/types.d.ts.map +1 -0
  63. package/dist/plugins/sdk/plugins/types.js +3 -0
  64. package/dist/plugins/sdk/plugins/types.js.map +1 -0
  65. package/dist/plugins/sdk/runner.d.ts +36 -0
  66. package/dist/plugins/sdk/runner.d.ts.map +1 -0
  67. package/dist/plugins/sdk/runner.js +324 -0
  68. package/dist/plugins/sdk/runner.js.map +1 -0
  69. package/package.json +21 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/schema/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;GAIG;AACH,eAAO,MAAM,WAAW,+CAA6C,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,cAAc,sCAAoC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,eAAO,MAAM,0BAA0B,QAAa,CAAC;AAerD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAed,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;IAErB,oEAAoE;;;;;;;;;;IAUpE,iFAAiF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKjF,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,mFAAmF;AACnF,eAAO,MAAM,iBAAiB;;;IAG5B,+EAA+E;;IAE/E,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ3D,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,uFAAuF;AACvF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBlB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,+EAA+E;AAC/E,eAAO,MAAM,cAAc;;IAGvB,iEAAiE;;;;;;;;;IASjE,2FAA2F;;IAE3F,gFAAgF;;;;;;;;;;;;;;QAhDlF,+EAA+E;;QAE/E,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAlC3D,oEAAoE;;;;;;;;;;QAUpE,iFAAiF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoG/E,CAAC;AACL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginManifest = exports.PluginConnection = exports.PluginIntegration = exports.PluginPermission = exports.PluginNode = exports.PluginNodeUi = exports.PLUGIN_UI_BUNDLE_MAX_BYTES = exports.PluginUiTarget = exports.PluginScope = void 0;
4
+ // Generated from packages/schema/src/plugin.ts. Do not edit; run the Octonode SDK sync.
5
+ const zod_1 = require("zod");
6
+ const ipc_envelope_1 = require("./ipc-envelope");
7
+ const icons_1 = require("./icons");
8
+ const constants_1 = require("./constants");
9
+ /**
10
+ * A plugin's distribution scope — who may discover and install it. `user` is
11
+ * private to its publisher in the hosted marketplace; group/org/public widen
12
+ * visibility. Local folder installs do not publish and remain local.
13
+ */
14
+ exports.PluginScope = zod_1.z.enum(["user", "group", "org", "public"]);
15
+ exports.PluginUiTarget = zod_1.z.enum(["node.inspector.inputs"]);
16
+ exports.PLUGIN_UI_BUNDLE_MAX_BYTES = 512 * 1024;
17
+ const pluginUiEntry = zod_1.z
18
+ .string()
19
+ .min(1)
20
+ .max(1_024)
21
+ .refine((value) => !value.startsWith("/") &&
22
+ !value.includes("\\") &&
23
+ !value.split("/").includes("..") &&
24
+ /\.[cm]?[jt]sx?$/.test(value), "UI entries must be relative JavaScript/TypeScript module paths");
25
+ exports.PluginNodeUi = zod_1.z
26
+ .object({
27
+ apiVersion: zod_1.z.literal("1"),
28
+ renderers: zod_1.z
29
+ .record(zod_1.z.string().regex(/^[a-z0-9][a-z0-9_-]*$/i, "renderer id must be alphanumeric/dash/underscore"), zod_1.z
30
+ .object({
31
+ label: zod_1.z.string().min(1).max(240),
32
+ targets: zod_1.z.record(exports.PluginUiTarget, pluginUiEntry),
33
+ })
34
+ .strict())
35
+ .refine((renderers) => Object.keys(renderers).length > 0, "UI needs at least one renderer"),
36
+ })
37
+ .strict();
38
+ /**
39
+ * One node contributed by a plugin. Unlike a project node (whose signature is
40
+ * discovered by `octonode scan`), a plugin node declares its contract directly
41
+ * in the manifest — the plugin author owns it. `command` is resolved relative
42
+ * to the plugin folder, so a plugin is a self-contained, relocatable bundle.
43
+ */
44
+ exports.PluginNode = zod_1.z.object({
45
+ id: zod_1.z.string().regex(/^[a-z0-9][a-z0-9_-]*$/i, "node id must be alphanumeric/dash/underscore"),
46
+ /** The command the engine spawns, relative to the plugin folder. */
47
+ command: zod_1.z.string(),
48
+ language: zod_1.z.string().optional(),
49
+ label: zod_1.z.string().min(1).max(240).optional(),
50
+ symbol: zod_1.z.string().min(1).max(16).optional(),
51
+ description: zod_1.z.string().optional(),
52
+ icon: icons_1.IconName.optional(),
53
+ trigger: zod_1.z.boolean().optional(),
54
+ inputs: ipc_envelope_1.JsonSchema.optional(),
55
+ outputs: ipc_envelope_1.JsonSchema.optional(),
56
+ /** Names of environment variables / secrets this node expects to be injected. */
57
+ env: zod_1.z.array(zod_1.z.string()).optional(),
58
+ connections: zod_1.z.array(zod_1.z.string().min(1)).optional(),
59
+ defaults: zod_1.z.record(zod_1.z.unknown()).optional(),
60
+ ui: exports.PluginNodeUi.optional(),
61
+ });
62
+ /**
63
+ * A coarse capability the plugin needs at runtime. Shown on the install
64
+ * consent screen and enforced before a node is handed the resource.
65
+ */
66
+ exports.PluginPermission = zod_1.z.object({
67
+ resource: zod_1.z.enum(["project_data", "secrets", "network"]),
68
+ access: zod_1.z.enum(["read", "write", "outbound"]),
69
+ });
70
+ /** Discovery/marketplace metadata (used by the Studio Marketplace in Phase 14). */
71
+ exports.PluginIntegration = zod_1.z.object({
72
+ category: zod_1.z.string().optional(),
73
+ tags: zod_1.z.array(zod_1.z.string()).default([]),
74
+ /** Secrets/env the integration needs to authenticate (e.g. ["JIRA_TOKEN"]). */
75
+ auth: zod_1.z.array(zod_1.z.string()).optional(),
76
+ /** Original npm dependency used by generated npm nodes. */
77
+ npm: zod_1.z
78
+ .object({
79
+ package: zod_1.z.string(),
80
+ version: zod_1.z.string(),
81
+ spec: zod_1.z.string(),
82
+ })
83
+ .optional(),
84
+ });
85
+ /** Credential metadata only. Values are supplied by the installing user at runtime. */
86
+ exports.PluginConnection = zod_1.z
87
+ .object({
88
+ label: zod_1.z.string().min(1).max(240),
89
+ description: zod_1.z.string().max(4_000).optional(),
90
+ fields: zod_1.z.record(zod_1.z.string().regex(/^[A-Z_][A-Z0-9_]*$/, "credential fields must be environment variable names"), zod_1.z
91
+ .object({
92
+ label: zod_1.z.string().min(1).max(240),
93
+ description: zod_1.z.string().max(4_000).optional(),
94
+ secret: zod_1.z.boolean().default(true),
95
+ required: zod_1.z.boolean().default(true),
96
+ })
97
+ .strict()),
98
+ })
99
+ .strict();
100
+ /** The shared plugin contract used by the SDK, generators, and marketplace. */
101
+ exports.PluginManifest = zod_1.z
102
+ .object({
103
+ schemaVersion: zod_1.z.string().default(constants_1.PLUGIN_SCHEMA_VERSION),
104
+ /** Stable plugin id; namespaces its nodes as `<id>/<nodeId>`. */
105
+ id: zod_1.z.string().regex(/^[a-z0-9][a-z0-9-]*$/, "plugin id must be lowercase alphanumeric/dash"),
106
+ name: zod_1.z.string(),
107
+ version: zod_1.z.string(),
108
+ description: zod_1.z.string().optional(),
109
+ icon: icons_1.IconName.optional(),
110
+ author: zod_1.z.string().optional(),
111
+ homepage: zod_1.z.string().optional(),
112
+ license: zod_1.z.string().optional(),
113
+ /** Distribution tiers this plugin may be discovered/installed from. Private by default. */
114
+ scope: zod_1.z.array(exports.PluginScope).default(["user"]),
115
+ /** Coarse runtime capabilities the plugin requests; consented to at install. */
116
+ permissions: zod_1.z.array(exports.PluginPermission).default([]),
117
+ integration: exports.PluginIntegration.optional(),
118
+ connections: zod_1.z.record(zod_1.z.string().regex(/^[a-z0-9][a-z0-9-]*$/), exports.PluginConnection).optional(),
119
+ nodes: zod_1.z.array(exports.PluginNode).default([]),
120
+ })
121
+ .superRefine((manifest, ctx) => {
122
+ const ids = new Set();
123
+ manifest.nodes.forEach((node, index) => {
124
+ if (ids.has(node.id))
125
+ ctx.addIssue({ code: "custom", path: ["nodes", index, "id"], message: "node IDs must be unique" });
126
+ ids.add(node.id);
127
+ for (const connection of node.connections ?? []) {
128
+ if (!Object.hasOwn(manifest.connections ?? {}, connection))
129
+ ctx.addIssue({
130
+ code: "custom",
131
+ path: ["nodes", index, "connections"],
132
+ message: `unknown connection "${connection}"`,
133
+ });
134
+ }
135
+ });
136
+ if (Object.keys(manifest.connections ?? {}).length &&
137
+ !manifest.permissions.some((permission) => permission.resource === "secrets" && permission.access === "read"))
138
+ ctx.addIssue({
139
+ code: "custom",
140
+ path: ["permissions"],
141
+ message: "credential connections require secrets:read permission",
142
+ });
143
+ });
144
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/plugins/schema/plugin.ts"],"names":[],"mappings":";;;AAAA,wFAAwF;AACxF,6BAAwB;AACxB,iDAA4C;AAC5C,mCAAmC;AACnC,2CAAoD;AAEpD;;;;GAIG;AACU,QAAA,WAAW,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGzD,QAAA,cAAc,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAEnD,QAAA,0BAA0B,GAAG,GAAG,GAAG,IAAI,CAAC;AAErD,MAAM,aAAa,GAAG,OAAC;KACpB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,KAAK,CAAC;KACV,MAAM,CACL,CAAC,KAAK,EAAE,EAAE,CACR,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;IACtB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;IACrB,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;IAChC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,EAC/B,gEAAgE,CACjE,CAAC;AAES,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,UAAU,EAAE,OAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC1B,SAAS,EAAE,OAAC;SACT,MAAM,CACL,OAAC,CAAC,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D,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,IAAI,EAAE,EAAE,UAAU,CAAC;gBACxD,GAAG,CAAC,QAAQ,CAAC;oBACX,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC;oBACrC,OAAO,EAAE,uBAAuB,UAAU,GAAG;iBAC9C,CAAC,CAAC;QACP,CAAC;IACH,CAAC,CAAC,CAAC;IACH,IACE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,MAAM;QAC9C,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,KAAK,MAAM,CAAC;QAE7G,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,aAAa,CAAC;YACrB,OAAO,EAAE,wDAAwD;SAClE,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,103 @@
1
+ import type { InvocationContext } from "../schema/plugin-sdk";
2
+ import type { JsonSchema } from "./json-schema";
3
+ /**
4
+ * What a node IS. `function` (default) is a data-flow node with inputs/outputs.
5
+ * `class`/`service`/`const` are setup-time entities with no runtime I/O ports —
6
+ * they're depended on by function nodes rather than feeding data into them.
7
+ */
8
+ export type NodeKind = "function" | "class" | "service" | "const";
9
+ /**
10
+ * The signature a node author writes: a plain (optionally async) function from
11
+ * a JSON `inputs` payload to a JSON `outputs` payload. The second argument is
12
+ * the invocation context (config, env, attempt, …). Nodes never touch stdin,
13
+ * stdout, or the envelope — the runner harness owns the wire.
14
+ */
15
+ export type NodeHandler<I = any, O = any> = (inputs: I, context: InvocationContext) => O | Promise<O>;
16
+ export interface NodeDefinition<I = any, O = any> {
17
+ /** Stable node id — the discovery key used by `octonode scan`. */
18
+ id: string;
19
+ workflowId?: string;
20
+ label?: string;
21
+ description?: string;
22
+ symbol?: string;
23
+ defaults?: Record<string, unknown>;
24
+ run: NodeHandler<I, O>;
25
+ /** JSON Schema for the inputs payload. Validated by the runner before `run`. */
26
+ inputs?: JsonSchema;
27
+ /** JSON Schema for the outputs payload. Validated by the runner after `run`. */
28
+ outputs?: JsonSchema;
29
+ /** What this node is. Omitted → `function`. */
30
+ kind?: NodeKind;
31
+ /** Setup params (constructor/config shape) for non-`function` kinds. */
32
+ setup?: JsonSchema;
33
+ /** Advisory default icon (a one-time seed; `.octonode` owns it thereafter). */
34
+ icon?: any;
35
+ /** Advisory default config (a one-time seed; `.octonode` owns it thereafter). */
36
+ config?: Record<string, unknown>;
37
+ }
38
+ export interface DefineNodeArgs<I, O> {
39
+ id?: string;
40
+ workflowId?: string;
41
+ label?: string;
42
+ description?: string;
43
+ symbol?: string;
44
+ defaults?: Record<string, unknown>;
45
+ run: NodeHandler<I, O>;
46
+ inputs?: JsonSchema;
47
+ outputs?: JsonSchema;
48
+ kind?: NodeKind;
49
+ setup?: JsonSchema;
50
+ icon?: any;
51
+ config?: Record<string, unknown>;
52
+ }
53
+ /**
54
+ * Declare a node: package its handler, id, and the JSON Schema for its I/O. The
55
+ * schemas are both enforced at runtime (the runner validates) and reported via
56
+ * `describe` so the engine can populate `.octonode` and type-check edges.
57
+ */
58
+ export declare function defineNode<I = any, O = any>(args: DefineNodeArgs<I, O>): NodeDefinition<I, O>;
59
+ /** Args for the setup-time helpers. These entities have setup params, not I/O ports. */
60
+ export interface DefineSetupArgs<I = any, O = any> {
61
+ id: string;
62
+ /** JSON Schema for the setup/constructor params — rendered as a form in the editor. */
63
+ setup?: JsonSchema;
64
+ /**
65
+ * How the entity materializes at runtime (instantiate a client, read config…).
66
+ * Optional: setup-time entities aren't part of the data DAG, so a missing run
67
+ * defaults to a no-op that echoes the resolved setup config.
68
+ */
69
+ run?: NodeHandler<I, O>;
70
+ icon?: any;
71
+ config?: Record<string, unknown>;
72
+ }
73
+ export interface ServiceMethodSpec {
74
+ /** Object input keys mapped to positional class-method arguments. */
75
+ params?: string[];
76
+ inputs?: JsonSchema;
77
+ outputs?: JsonSchema;
78
+ }
79
+ export interface DefineExplicitServiceArgs<T extends object> {
80
+ id: string;
81
+ create: (context: InvocationContext) => T | Promise<T>;
82
+ expose: readonly (keyof T & string)[] | Record<string, ServiceMethodSpec>;
83
+ lifecycle?: "invocation" | "workflow-run" | "worker";
84
+ icon?: any;
85
+ setup?: JsonSchema;
86
+ config?: Record<string, unknown>;
87
+ }
88
+ export interface ServiceDefinition<T extends object = object> extends NodeDefinition {
89
+ kind: "service";
90
+ service: {
91
+ create: (context: InvocationContext) => T | Promise<T>;
92
+ lifecycle: "invocation" | "workflow-run" | "worker";
93
+ methods: Record<string, ServiceMethodSpec>;
94
+ };
95
+ }
96
+ /** Declare a service. Only the explicit create/expose form turns class methods into callable nodes. */
97
+ export declare function defineService<T extends object>(args: DefineExplicitServiceArgs<T>): ServiceDefinition<T>;
98
+ export declare function defineService<I = any, O = any>(args: DefineSetupArgs<I, O>): NodeDefinition<I, O>;
99
+ /** Declare a class: a class definition (constructor/config params, methods). */
100
+ export declare function defineClass<I = any, O = any>(args: DefineSetupArgs<I, O>): NodeDefinition<I, O>;
101
+ /** Declare a const: a configuration constant referenced by other nodes. */
102
+ export declare function defineConst<I = any, O = any>(args: DefineSetupArgs<I, O>): NodeDefinition<I, O>;
103
+ //# sourceMappingURL=define-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-node.d.ts","sourceRoot":"","sources":["../../../src/plugins/sdk/define-node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;A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C,EAAE,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAE/F"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineNode = defineNode;
4
+ exports.defineService = defineService;
5
+ exports.defineClass = defineClass;
6
+ exports.defineConst = defineConst;
7
+ /**
8
+ * Declare a node: package its handler, id, and the JSON Schema for its I/O. The
9
+ * schemas are both enforced at runtime (the runner validates) and reported via
10
+ * `describe` so the engine can populate `.octonode` and type-check edges.
11
+ */
12
+ function defineNode(args) {
13
+ return {
14
+ id: args.id ?? "node",
15
+ ...(args.workflowId ? { workflowId: args.workflowId } : {}),
16
+ run: args.run,
17
+ label: args.label,
18
+ description: args.description,
19
+ symbol: args.symbol,
20
+ defaults: args.defaults,
21
+ inputs: args.inputs,
22
+ outputs: args.outputs,
23
+ kind: args.kind,
24
+ setup: args.setup,
25
+ icon: args.icon,
26
+ config: args.config,
27
+ };
28
+ }
29
+ const setupPassthrough = (_inputs, context) => (context?.config ?? {});
30
+ function defineService(args) {
31
+ if ("create" in args && "expose" in args) {
32
+ const methods = Array.isArray(args.expose)
33
+ ? Object.fromEntries(args.expose.map((name) => [String(name), {}]))
34
+ : args.expose;
35
+ return {
36
+ ...defineNode({
37
+ id: args.id,
38
+ run: setupPassthrough,
39
+ kind: "service",
40
+ setup: args.setup,
41
+ icon: args.icon,
42
+ config: args.config,
43
+ }),
44
+ kind: "service",
45
+ service: { create: args.create, lifecycle: args.lifecycle ?? "invocation", methods },
46
+ };
47
+ }
48
+ return defineNode({ ...args, run: args.run ?? setupPassthrough, kind: "service" });
49
+ }
50
+ /** Declare a class: a class definition (constructor/config params, methods). */
51
+ function defineClass(args) {
52
+ return defineNode({ ...args, run: args.run ?? setupPassthrough, kind: "class" });
53
+ }
54
+ /** Declare a const: a configuration constant referenced by other nodes. */
55
+ function defineConst(args) {
56
+ return defineNode({ ...args, run: args.run ?? setupPassthrough, kind: "const" });
57
+ }
58
+ //# sourceMappingURL=define-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-node.js","sourceRoot":"","sources":["../../../src/plugins/sdk/define-node.ts"],"names":[],"mappings":";;AA+DA,gCAgBC;AAgDD,sCAqBC;AAGD,kCAEC;AAGD,kCAEC;AApGD;;;;GAIG;AACH,SAAgB,UAAU,CAAmB,IAA0B;IACrE,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,MAAM;QACrB,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC;AACJ,CAAC;AA2CD,MAAM,gBAAgB,GAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,CAAQ,CAAC;AAK3F,SAAgB,aAAa,CAC3B,IAA0D;IAE1D,IAAI,QAAQ,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;YACxC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YACnE,CAAC,CAAE,IAAI,CAAC,MAA4C,CAAC;QACvD,OAAO;YACL,GAAG,UAAU,CAAC;gBACZ,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,GAAG,EAAE,gBAAgB;gBACrB,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC;YACF,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,YAAY,EAAE,OAAO,EAAE;SAC7D,CAAC;IAC5B,CAAC;IACD,OAAO,UAAU,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AACrF,CAAC;AAED,gFAAgF;AAChF,SAAgB,WAAW,CAAmB,IAA2B;IACvE,OAAO,UAAU,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACnF,CAAC;AAED,2EAA2E;AAC3E,SAAgB,WAAW,CAAmB,IAA2B;IACvE,OAAO,UAAU,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A deliberately tiny JSON Schema validator covering the common subset Octonode
3
+ * nodes use to describe their I/O: `type`, `required`, `properties`, `items`,
4
+ * and `enum`. It is intentionally NOT a full JSON Schema implementation — the
5
+ * point is that every language SDK can carry an equivalent ~80-line validator
6
+ * with zero dependencies, so the contract is enforced identically everywhere.
7
+ *
8
+ * Unknown/unsupported keywords are ignored (treated as "no constraint"), so a
9
+ * richer schema still validates its supported parts rather than failing hard.
10
+ */
11
+ export type JsonSchema = Record<string, unknown>;
12
+ export interface ValidationError {
13
+ path: string;
14
+ message: string;
15
+ }
16
+ export declare function validate(schema: JsonSchema | undefined, data: unknown): ValidationError[];
17
+ //# sourceMappingURL=json-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../../src/plugins/sdk/json-schema.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,OAAO,GAAG,eAAe,EAAE,CAKzF"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validate = validate;
4
+ function validate(schema, data) {
5
+ if (!schema)
6
+ return [];
7
+ const errors = [];
8
+ walk(schema, data, "$", errors);
9
+ return errors;
10
+ }
11
+ function walk(schema, data, path, errors) {
12
+ const allowed = normalizeTypes(schema.type);
13
+ if (allowed.length > 0 && !allowed.some((t) => matchesType(t, data))) {
14
+ errors.push({ path, message: `expected type ${allowed.join("|")}, got ${jsonType(data)}` });
15
+ return; // type is wrong; nested checks would be noise
16
+ }
17
+ if (Array.isArray(schema.enum) && !schema.enum.some((v) => deepEqual(v, data))) {
18
+ errors.push({ path, message: `value is not one of the allowed enum values` });
19
+ }
20
+ if (isPlainObject(data)) {
21
+ const required = Array.isArray(schema.required) ? schema.required : [];
22
+ for (const key of required) {
23
+ if (!(key in data))
24
+ errors.push({ path: `${path}.${key}`, message: `missing required property` });
25
+ }
26
+ const props = isPlainObject(schema.properties) ? schema.properties : undefined;
27
+ if (props) {
28
+ for (const [key, sub] of Object.entries(props)) {
29
+ if (key in data && isPlainObject(sub)) {
30
+ walk(sub, data[key], `${path}.${key}`, errors);
31
+ }
32
+ }
33
+ }
34
+ }
35
+ if (Array.isArray(data) && isPlainObject(schema.items)) {
36
+ data.forEach((item, i) => walk(schema.items, item, `${path}[${i}]`, errors));
37
+ }
38
+ }
39
+ function normalizeTypes(type) {
40
+ if (typeof type === "string")
41
+ return [type];
42
+ if (Array.isArray(type))
43
+ return type.filter((t) => typeof t === "string");
44
+ return [];
45
+ }
46
+ function matchesType(type, data) {
47
+ switch (type) {
48
+ case "object":
49
+ return isPlainObject(data);
50
+ case "array":
51
+ return Array.isArray(data);
52
+ case "string":
53
+ return typeof data === "string";
54
+ case "number":
55
+ return typeof data === "number" && Number.isFinite(data);
56
+ case "integer":
57
+ return typeof data === "number" && Number.isInteger(data);
58
+ case "boolean":
59
+ return typeof data === "boolean";
60
+ case "null":
61
+ return data === null;
62
+ default:
63
+ return true; // unknown declared type → don't constrain
64
+ }
65
+ }
66
+ function jsonType(data) {
67
+ if (data === null)
68
+ return "null";
69
+ if (Array.isArray(data))
70
+ return "array";
71
+ return typeof data;
72
+ }
73
+ function isPlainObject(v) {
74
+ return typeof v === "object" && v !== null && !Array.isArray(v);
75
+ }
76
+ function deepEqual(a, b) {
77
+ return JSON.stringify(a) === JSON.stringify(b);
78
+ }
79
+ //# sourceMappingURL=json-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../../../src/plugins/sdk/json-schema.ts"],"names":[],"mappings":";;AAkBA,4BAKC;AALD,SAAgB,QAAQ,CAAC,MAA8B,EAAE,IAAa;IACpE,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC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,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;QAClC,KAAK,QAAQ;YACX,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,SAAS;YACZ,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5D,KAAK,SAAS;YACZ,OAAO,OAAO,IAAI,KAAK,SAAS,CAAC;QACnC,KAAK,MAAM;YACT,OAAO,IAAI,KAAK,IAAI,CAAC;QACvB;YACE,OAAO,IAAI,CAAC,CAAC,0CAA0C;IAC3D,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,IAAa;IAC7B,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IACjC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IACxC,OAAO,OAAO,IAAI,CAAC;AACrB,CAAC;AAED,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,SAAS,CAAC,CAAU,EAAE,CAAU;IACvC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { PluginDefinition, PluginHandlers, PluginOptions } from "./plugin.types";
2
+ /** One definition owns discovery, presentation, ports, and the SDK runtime contract. */
3
+ export declare function definePlugin(definition: PluginOptions): PluginDefinition;
4
+ export declare function definePlugin(definition: unknown, handlers: PluginHandlers): PluginDefinition;
5
+ /** The manifest command selects a node: `node dist/index.js <node-id>`. */
6
+ export declare function startPlugin(plugin: PluginDefinition, nodeId?: string): void;
7
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/sdk/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEtF,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,UAAU,EAAE,aAAa,GAAG,gBAAgB,CAAC;AAC1E,wBAAgB,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,GAAG,gBAAgB,CAAC;AA2D9F,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,SAAkB,GAAG,IAAI,CAKpF"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.definePlugin = definePlugin;
4
+ exports.startPlugin = startPlugin;
5
+ // Generated from sdks/typescript/src/plugin.ts. Do not edit; run the Octonode SDK sync.
6
+ const plugin_sdk_1 = require("../schema/plugin-sdk");
7
+ const define_node_1 = require("./define-node");
8
+ const runner_1 = require("./runner");
9
+ function definePlugin(definition, handlers) {
10
+ const options = definition;
11
+ if (!handlers && (!options || !Array.isArray(options.nodes)))
12
+ throw new Error("plugin needs a nodes array");
13
+ if (!handlers) {
14
+ for (const node of options.nodes) {
15
+ if (typeof node.run !== "function")
16
+ throw new Error(`plugin node "${node.id}" needs a handler`);
17
+ if (node.kind && node.kind !== "function")
18
+ throw new Error("plugin nodes must be functions");
19
+ }
20
+ }
21
+ const manifest = plugin_sdk_1.PluginManifest.parse(handlers
22
+ ? definition
23
+ : {
24
+ ...options,
25
+ nodes: options.nodes.map(({ run: _run, ...node }) => ({
26
+ ...node,
27
+ command: `node dist/index.js ${node.id}`,
28
+ language: "typescript",
29
+ })),
30
+ });
31
+ const nodeHandlers = handlers ?? Object.fromEntries(options.nodes.map((node) => [node.id, node.run]));
32
+ for (const node of manifest.nodes) {
33
+ for (const field of ["inputs", "outputs", "defaults"]) {
34
+ const error = node[field] === undefined ? undefined : (0, runner_1.jsonSafetyError)(node[field]);
35
+ if (error)
36
+ throw new Error(`plugin node "${node.id}" ${field} must be JSON-serializable: ${error}`);
37
+ }
38
+ }
39
+ for (const id of Object.keys(nodeHandlers)) {
40
+ if (!manifest.nodes.some((node) => node.id === id))
41
+ throw new Error(`handler "${id}" has no plugin node`);
42
+ }
43
+ return {
44
+ manifest,
45
+ ...(!handlers && options.assets ? { assets: options.assets } : {}),
46
+ nodes: Object.fromEntries(manifest.nodes.map((node) => {
47
+ if (!Object.hasOwn(nodeHandlers, node.id))
48
+ throw new Error(`plugin node "${node.id}" needs a handler`);
49
+ const fields = (node.connections ?? []).flatMap((id) => Object.entries(manifest.connections?.[id]?.fields ?? {}));
50
+ return [
51
+ node.id,
52
+ (0, define_node_1.defineNode)({
53
+ ...node,
54
+ run: (inputs, context) => {
55
+ const missing = fields
56
+ .filter(([name, field]) => field.required && !process.env[name])
57
+ .map(([name]) => name);
58
+ if (missing.length)
59
+ throw new runner_1.NodeError(`Missing connection credentials: ${missing.join(", ")}`);
60
+ return nodeHandlers[node.id](inputs, context);
61
+ },
62
+ }),
63
+ ];
64
+ })),
65
+ };
66
+ }
67
+ /** The manifest command selects a node: `node dist/index.js <node-id>`. */
68
+ function startPlugin(plugin, nodeId = process.argv[2]) {
69
+ const id = nodeId ?? (plugin.manifest.nodes.length === 1 ? plugin.manifest.nodes[0].id : undefined);
70
+ if (!id || !Object.hasOwn(plugin.nodes, id))
71
+ throw new Error(`Choose a plugin node: ${Object.keys(plugin.nodes).join(", ")}`);
72
+ (0, runner_1.start)(plugin.nodes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AM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACpG,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnF,IAAA,cAAK,EAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { PluginManifest } from "../schema/plugin-sdk";
2
+ import type { NodeDefinition, NodeHandler } from "./define-node";
3
+ import type { PluginManifestInput, PluginNode } from "../schema/plugin-sdk";
4
+ export interface PluginDefinition {
5
+ manifest: PluginManifest;
6
+ nodes: Record<string, NodeDefinition>;
7
+ /** Project-relative assets copied into the built plugin. Never credential files. */
8
+ assets?: readonly string[];
9
+ }
10
+ export type PluginHandlers = Record<string, NodeHandler>;
11
+ export type PluginOptions = Omit<PluginManifestInput, "nodes"> & {
12
+ nodes: readonly (NodeDefinition & Pick<PluginNode, "connections" | "env" | "trigger">)[];
13
+ assets?: readonly string[];
14
+ };
15
+ //# sourceMappingURL=plugin.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.types.d.ts","sourceRoot":"","sources":["../../../src/plugins/sdk/plugin.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,oFAAoF;IACpF,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,GAAG;IAC/D,KAAK,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,KAAK,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC;IACzF,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=plugin.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.types.js","sourceRoot":"","sources":["../../../src/plugins/sdk/plugin.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import type { JsonSchema } from "../json-schema";
2
+ import type { PluginNodeOptions } from "./types";
3
+ /** Plugin authoring keeps the portable contract beside its typed handler. */
4
+ export declare function defineNode<const I extends JsonSchema, const O extends JsonSchema>(args: PluginNodeOptions<I, O>): {
5
+ connections: string[] | undefined;
6
+ env: string[] | undefined;
7
+ trigger: boolean | undefined;
8
+ ui: {
9
+ apiVersion: "1";
10
+ renderers: Record<string, {
11
+ label: string;
12
+ targets: Partial<Record<"node.inspector.inputs", string>>;
13
+ }>;
14
+ } | undefined;
15
+ id: string;
16
+ workflowId?: string;
17
+ label?: string;
18
+ description?: string;
19
+ symbol?: string;
20
+ defaults?: Record<string, unknown>;
21
+ run: import("../define-node").NodeHandler<import("./types").SchemaValue<I>, import("./types").SchemaValue<O>>;
22
+ inputs?: JsonSchema;
23
+ outputs?: JsonSchema;
24
+ kind?: import("../define-node").NodeKind;
25
+ setup?: JsonSchema;
26
+ icon?: any;
27
+ config?: Record<string, unknown>;
28
+ };
29
+ //# sourceMappingURL=define-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-node.d.ts","sourceRoot":"","sources":["../../../../src/plugins/sdk/plugins/define-node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;EAQ/G"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineNode = defineNode;
4
+ // Generated from sdks/typescript/src/plugins/define-node.ts. Do not edit; run the Octonode SDK sync.
5
+ const define_node_1 = require("../define-node");
6
+ /** Plugin authoring keeps the portable contract beside its typed handler. */
7
+ function defineNode(args) {
8
+ return {
9
+ ...(0, define_node_1.defineNode)(args),
10
+ connections: args.connections,
11
+ env: args.env,
12
+ trigger: args.trigger,
13
+ ui: args.ui,
14
+ };
15
+ }
16
+ //# sourceMappingURL=define-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-node.js","sourceRoot":"","sources":["../../../../src/plugins/sdk/plugins/define-node.ts"],"names":[],"mappings":";;AAMA,gCAQC;AAdD,qGAAqG;AACrG,gDAAiE;AAIjE,6EAA6E;AAC7E,SAAgB,UAAU,CAAyD,IAA6B;IAC9G,OAAO;QACL,GAAG,IAAA,wBAAiB,EAAC,IAAI,CAAC;QAC1B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,EAAE,EAAE,IAAI,CAAC,EAAE;KACZ,CAAC;AACJ,CAAC"}