@proteos/sdk 0.18.1

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 (94) hide show
  1. package/LICENSE +40 -0
  2. package/dist/chunk-7RGN4E22.cjs +1185 -0
  3. package/dist/chunk-7RGN4E22.cjs.map +1 -0
  4. package/dist/chunk-XJP5WCRZ.js +1125 -0
  5. package/dist/chunk-XJP5WCRZ.js.map +1 -0
  6. package/dist/index.cjs +2384 -0
  7. package/dist/index.cjs.map +1 -0
  8. package/dist/index.d.cts +5225 -0
  9. package/dist/index.d.ts +5225 -0
  10. package/dist/index.js +2146 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/meta/index.cjs +204 -0
  13. package/dist/meta/index.cjs.map +1 -0
  14. package/dist/meta/index.d.cts +2 -0
  15. package/dist/meta/index.d.ts +2 -0
  16. package/dist/meta/index.js +3 -0
  17. package/dist/meta/index.js.map +1 -0
  18. package/dist/types-BNsjfU8N.d.cts +3299 -0
  19. package/dist/types-BNsjfU8N.d.ts +3299 -0
  20. package/package.json +86 -0
  21. package/src/agent/agents.ts +53 -0
  22. package/src/agent/index.ts +134 -0
  23. package/src/agent/mcp-servers.ts +102 -0
  24. package/src/agent/prompts.ts +80 -0
  25. package/src/agent/session-types.ts +397 -0
  26. package/src/agent/sessions.ts +197 -0
  27. package/src/agent/skills.ts +89 -0
  28. package/src/agent/tools.ts +53 -0
  29. package/src/agent/types.ts +362 -0
  30. package/src/auth/index.ts +111 -0
  31. package/src/auth/me.ts +46 -0
  32. package/src/auth/organizations.ts +128 -0
  33. package/src/auth/platform-entities.ts +78 -0
  34. package/src/auth/roles.ts +213 -0
  35. package/src/auth/types.ts +294 -0
  36. package/src/auth/users.ts +226 -0
  37. package/src/client.ts +441 -0
  38. package/src/connector/index.ts +120 -0
  39. package/src/connector/types.ts +150 -0
  40. package/src/conversation/index.ts +297 -0
  41. package/src/conversation/types.ts +590 -0
  42. package/src/conversation/voice.ts +123 -0
  43. package/src/data/index.ts +53 -0
  44. package/src/data/queries.ts +66 -0
  45. package/src/data/records.ts +122 -0
  46. package/src/data/types.ts +89 -0
  47. package/src/errors.ts +148 -0
  48. package/src/events/index.ts +172 -0
  49. package/src/events/types.ts +77 -0
  50. package/src/functions/actions.ts +95 -0
  51. package/src/functions/index.ts +32 -0
  52. package/src/functions/types.ts +71 -0
  53. package/src/http/index.ts +2 -0
  54. package/src/http/query-params.ts +106 -0
  55. package/src/index.ts +598 -0
  56. package/src/iterator.ts +183 -0
  57. package/src/knowledge/graph.ts +35 -0
  58. package/src/knowledge/index.ts +104 -0
  59. package/src/knowledge/labels.ts +70 -0
  60. package/src/knowledge/links.ts +65 -0
  61. package/src/knowledge/nodes.ts +198 -0
  62. package/src/knowledge/record-links.ts +66 -0
  63. package/src/knowledge/types.ts +569 -0
  64. package/src/meta/apps.ts +107 -0
  65. package/src/meta/components.ts +124 -0
  66. package/src/meta/currency/index.ts +202 -0
  67. package/src/meta/entities.ts +193 -0
  68. package/src/meta/filters.ts +76 -0
  69. package/src/meta/index.ts +227 -0
  70. package/src/meta/layout/common-props.ts +93 -0
  71. package/src/meta/layout/control-registry.json +70 -0
  72. package/src/meta/layout/control-registry.ts +92 -0
  73. package/src/meta/layout/elements.ts +203 -0
  74. package/src/meta/layout/index.ts +41 -0
  75. package/src/meta/layout/page-layout.ts +35 -0
  76. package/src/meta/layout/size-value.ts +27 -0
  77. package/src/meta/list-views.ts +109 -0
  78. package/src/meta/lists.ts +104 -0
  79. package/src/meta/menu-configurations.ts +128 -0
  80. package/src/meta/modules.ts +159 -0
  81. package/src/meta/pages.ts +106 -0
  82. package/src/meta/types.ts +1115 -0
  83. package/src/meta/variables.ts +98 -0
  84. package/src/storage/files.ts +183 -0
  85. package/src/storage/index.ts +33 -0
  86. package/src/storage/types.ts +70 -0
  87. package/src/types/common.ts +143 -0
  88. package/src/types/index.ts +28 -0
  89. package/src/types/options.ts +95 -0
  90. package/src/workflow/executions.ts +99 -0
  91. package/src/workflow/index.ts +109 -0
  92. package/src/workflow/node-types.ts +50 -0
  93. package/src/workflow/types.ts +658 -0
  94. package/src/workflow/workflows.ts +152 -0
@@ -0,0 +1,99 @@
1
+ import type { ProteosClient } from '../client.js'
2
+ import { PageIterator } from '../iterator.js'
3
+ import type { ListResult } from '../types/common.js'
4
+ import type {
5
+ GetExecutionDetailResponse,
6
+ GetNodeExecutionItemsOptions,
7
+ GetNodeExecutionItemsResponse,
8
+ ListExecutionsOptions,
9
+ WorkflowExecution,
10
+ } from './types.js'
11
+
12
+ const EXECUTIONS_BASE_PATH = '/workflows/v1/executions'
13
+ const WORKFLOWS_BASE_PATH = '/workflows/v1/workflows'
14
+
15
+ /**
16
+ * Service for reading Workflow Executions — append-only per-firing run records,
17
+ * keyed by surrogate `id`, referencing their workflow by `workflow_key`.
18
+ */
19
+ export interface ExecutionService {
20
+ /** Lists executions, auto-paginating. */
21
+ list(options?: ListExecutionsOptions): PageIterator<WorkflowExecution, ListExecutionsOptions>
22
+ /** Fetches a single page of executions with pagination metadata. */
23
+ listPage(options?: ListExecutionsOptions): Promise<ListResult<WorkflowExecution>>
24
+ /** Gets a single execution by id. @throws {ProteosError} 404 if not found. */
25
+ get(id: string): Promise<WorkflowExecution>
26
+ /**
27
+ * Gets the execution detail: the header row plus its append-only node
28
+ * executions (ordered by started_at, then run_index).
29
+ */
30
+ getDetail(id: string): Promise<GetExecutionDetailResponse>
31
+ /**
32
+ * Windows into one node run's stored output items on one port (defaults:
33
+ * port `main`, offset 0, server-side default limit).
34
+ */
35
+ getNodeItems(
36
+ executionId: string,
37
+ nodeId: string,
38
+ runIndex: number,
39
+ options?: GetNodeExecutionItemsOptions,
40
+ ): Promise<GetNodeExecutionItemsResponse>
41
+ /** Lists executions of one workflow (by key). */
42
+ listForWorkflow(
43
+ key: string,
44
+ options?: ListExecutionsOptions,
45
+ ): Promise<ListResult<WorkflowExecution>>
46
+ }
47
+
48
+ export class ExecutionServiceImpl implements ExecutionService {
49
+ constructor(private readonly client: ProteosClient) {}
50
+
51
+ list(
52
+ options: ListExecutionsOptions = {},
53
+ ): PageIterator<WorkflowExecution, ListExecutionsOptions> {
54
+ return new PageIterator((opts) => this.listPage(opts), options)
55
+ }
56
+
57
+ async listPage(options: ListExecutionsOptions = {}): Promise<ListResult<WorkflowExecution>> {
58
+ return this.client.requestWithQuery<ListResult<WorkflowExecution>>(
59
+ 'GET',
60
+ EXECUTIONS_BASE_PATH,
61
+ options,
62
+ )
63
+ }
64
+
65
+ async get(id: string): Promise<WorkflowExecution> {
66
+ return this.client.request<WorkflowExecution>('GET', `${EXECUTIONS_BASE_PATH}/${id}`)
67
+ }
68
+
69
+ async getDetail(id: string): Promise<GetExecutionDetailResponse> {
70
+ return this.client.request<GetExecutionDetailResponse>(
71
+ 'GET',
72
+ `${EXECUTIONS_BASE_PATH}/${id}/detail`,
73
+ )
74
+ }
75
+
76
+ async getNodeItems(
77
+ executionId: string,
78
+ nodeId: string,
79
+ runIndex: number,
80
+ options: GetNodeExecutionItemsOptions = {},
81
+ ): Promise<GetNodeExecutionItemsResponse> {
82
+ return this.client.requestWithQuery<GetNodeExecutionItemsResponse>(
83
+ 'GET',
84
+ `${EXECUTIONS_BASE_PATH}/${executionId}/nodes/${nodeId}/runs/${runIndex}/items`,
85
+ options,
86
+ )
87
+ }
88
+
89
+ async listForWorkflow(
90
+ key: string,
91
+ options: ListExecutionsOptions = {},
92
+ ): Promise<ListResult<WorkflowExecution>> {
93
+ return this.client.requestWithQuery<ListResult<WorkflowExecution>>(
94
+ 'GET',
95
+ `${WORKFLOWS_BASE_PATH}/${key}/executions`,
96
+ options,
97
+ )
98
+ }
99
+ }
@@ -0,0 +1,109 @@
1
+ import type { ProteosClient } from '../client.js'
2
+ import { type ExecutionService, ExecutionServiceImpl } from './executions.js'
3
+ import { type NodeTypeService, NodeTypeServiceImpl } from './node-types.js'
4
+ import { type WorkflowService, WorkflowServiceImpl } from './workflows.js'
5
+
6
+ /**
7
+ * Client for the Proteos Workflow Service API.
8
+ *
9
+ * Manages n8n-shaped automation workflows (keyed by immutable `key`), the
10
+ * node-type catalog (NodeDescriptors) that drives the editor, and workflow
11
+ * executions (Temporal-backed, surrogate-id'd).
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { ProteosClient, WorkflowClient } from '@proteos/sdk';
16
+ *
17
+ * const client = new ProteosClient({ baseUrl, token });
18
+ * const workflow = new WorkflowClient(client);
19
+ *
20
+ * const catalog = await workflow.nodeTypes.list();
21
+ * const workflows = await workflow.workflows.list().all();
22
+ * const execution = await workflow.workflows.run('nightly-triage');
23
+ * const detail = await workflow.executions.getDetail(execution.id);
24
+ * ```
25
+ */
26
+ export class WorkflowClient {
27
+ /** Service for managing workflow definitions. */
28
+ readonly workflows: WorkflowService
29
+ /** Service for reading workflow executions. */
30
+ readonly executions: ExecutionService
31
+ /** Service for the node-type catalog + dynamic node methods. */
32
+ readonly nodeTypes: NodeTypeService
33
+
34
+ constructor(client: ProteosClient) {
35
+ this.workflows = new WorkflowServiceImpl(client)
36
+ this.executions = new ExecutionServiceImpl(client)
37
+ this.nodeTypes = new NodeTypeServiceImpl(client)
38
+ }
39
+ }
40
+
41
+ export type { ExecutionService } from './executions.js'
42
+ export type { NodeTypeService } from './node-types.js'
43
+ export type {
44
+ AgentActionParams,
45
+ AgentKickoff,
46
+ BinaryRef,
47
+ ConnectionEndpoint,
48
+ CreateWorkflowRequest,
49
+ CredentialSpec,
50
+ CronTriggerParams,
51
+ DisplayOptions,
52
+ EventTriggerParams,
53
+ EventVerb,
54
+ ExecutionError,
55
+ ExecutionStatus,
56
+ ExecutionTriggerContext,
57
+ GetExecutionDetailResponse,
58
+ GetNodeExecutionItemsOptions,
59
+ GetNodeExecutionItemsResponse,
60
+ GetNodeTypesResponse,
61
+ InvokeNodeMethodRequest,
62
+ InvokeNodeMethodResponse,
63
+ Item,
64
+ KickoffSource,
65
+ KickoffType,
66
+ ListExecutionsOptions,
67
+ ListWorkflowsOptions,
68
+ ManualTriggerParams,
69
+ MessageKickoff,
70
+ MessageTriggerParams,
71
+ NodeDescriptor,
72
+ NodeExecution,
73
+ NodeGroup,
74
+ NodeMethodOption,
75
+ NodePosition,
76
+ NodeProperty,
77
+ NodeRetryPolicy,
78
+ NodeRuntime,
79
+ NodeTypeKey,
80
+ NodeTypeStatus,
81
+ OnErrorPolicy,
82
+ OutcomeKickoff,
83
+ OutcomeRubric,
84
+ PairedItem,
85
+ PortSpec,
86
+ PropertyOption,
87
+ PropertyType,
88
+ RunWorkflowRequest,
89
+ TestNodeCandidate,
90
+ TestNodeInputSource,
91
+ TestNodeRequest,
92
+ TestNodeResponse,
93
+ TriggerKind,
94
+ UpdateWorkflowRequest,
95
+ WebhookTriggerParams,
96
+ Workflow,
97
+ WorkflowConnection,
98
+ WorkflowContentBlock,
99
+ WorkflowExecution,
100
+ WorkflowGraph,
101
+ WorkflowNode,
102
+ WorkflowNodeType,
103
+ WorkflowStatus,
104
+ WorkflowVersion,
105
+ WorkflowVersionAuthor,
106
+ WorkflowVersionSummary,
107
+ } from './types.js'
108
+ export { DEFAULT_PORT, ERROR_PORT } from './types.js'
109
+ export type { WorkflowService } from './workflows.js'
@@ -0,0 +1,50 @@
1
+ import type { ProteosClient } from '../client.js'
2
+ import type {
3
+ GetNodeTypesResponse,
4
+ InvokeNodeMethodRequest,
5
+ InvokeNodeMethodResponse,
6
+ NodeTypeKey,
7
+ WorkflowNodeType,
8
+ } from './types.js'
9
+
10
+ const NODE_TYPES_BASE_PATH = '/workflows/v1/node-types'
11
+
12
+ /**
13
+ * Service for the node-type catalog — the registered NodeDescriptors that
14
+ * drive the editor's picker and parameter forms — and for proxying editor
15
+ * dynamic-method calls (load_options / list_search / …) to the node host.
16
+ */
17
+ export interface NodeTypeService {
18
+ /**
19
+ * Lists the catalog visible to the caller's org (platform-global +
20
+ * org-installed types, all registered versions, active only).
21
+ */
22
+ list(): Promise<WorkflowNodeType[]>
23
+ /**
24
+ * Invokes a dynamic method on a node type (e.g. `load_options:listEntities`
25
+ * — pass the full `<kind>:<method_name>` string; it is URL-encoded here).
26
+ */
27
+ invokeMethod(
28
+ type: NodeTypeKey,
29
+ method: string,
30
+ request?: InvokeNodeMethodRequest,
31
+ ): Promise<InvokeNodeMethodResponse>
32
+ }
33
+
34
+ export class NodeTypeServiceImpl implements NodeTypeService {
35
+ constructor(private readonly client: ProteosClient) {}
36
+
37
+ async list(): Promise<WorkflowNodeType[]> {
38
+ const response = await this.client.request<GetNodeTypesResponse>('GET', NODE_TYPES_BASE_PATH)
39
+ return response.data
40
+ }
41
+
42
+ async invokeMethod(
43
+ type: NodeTypeKey,
44
+ method: string,
45
+ request: InvokeNodeMethodRequest = {},
46
+ ): Promise<InvokeNodeMethodResponse> {
47
+ const path = `${NODE_TYPES_BASE_PATH}/${encodeURIComponent(type)}/methods/${encodeURIComponent(method)}`
48
+ return this.client.request<InvokeNodeMethodResponse>('POST', path, request)
49
+ }
50
+ }