@stigmer/cli 3.5.3 → 3.6.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/commands/list.js +8 -5
- package/commands/list.js.map +1 -1
- package/commands/resume.js +5 -1
- package/commands/resume.js.map +1 -1
- package/commands/schedule.d.ts +3 -0
- package/commands/schedule.d.ts.map +1 -0
- package/commands/schedule.js +57 -0
- package/commands/schedule.js.map +1 -0
- package/package.json +5 -5
- package/program.d.ts.map +1 -1
- package/program.js +2 -0
- package/program.js.map +1 -1
- package/registry/metadata.d.ts.map +1 -1
- package/registry/metadata.js +2 -0
- package/registry/metadata.js.map +1 -1
- package/registry/verb-support.d.ts.map +1 -1
- package/registry/verb-support.js +29 -21
- package/registry/verb-support.js.map +1 -1
- package/registry/verbs.d.ts.map +1 -1
- package/registry/verbs.js +0 -1
- package/registry/verbs.js.map +1 -1
- package/resources/apply/apply.d.ts +6 -1
- package/resources/apply/apply.d.ts.map +1 -1
- package/resources/apply/apply.js +14 -24
- package/resources/apply/apply.js.map +1 -1
- package/resources/apply/handlers.d.ts +9 -1
- package/resources/apply/handlers.d.ts.map +1 -1
- package/resources/apply/handlers.js +50 -148
- package/resources/apply/handlers.js.map +1 -1
- package/resources/delete.d.ts +12 -0
- package/resources/delete.d.ts.map +1 -1
- package/resources/delete.js +8 -4
- package/resources/delete.js.map +1 -1
- package/resources/execution.d.ts +14 -4
- package/resources/execution.d.ts.map +1 -1
- package/resources/execution.js +16 -6
- package/resources/execution.js.map +1 -1
- package/resources/get-bindings.d.ts +1 -0
- package/resources/get-bindings.d.ts.map +1 -1
- package/resources/get-bindings.js +8 -1
- package/resources/get-bindings.js.map +1 -1
- package/resources/list.d.ts +4 -0
- package/resources/list.d.ts.map +1 -1
- package/resources/list.js +95 -27
- package/resources/list.js.map +1 -1
- package/resources/reference.d.ts +2 -0
- package/resources/reference.d.ts.map +1 -1
- package/resources/reference.js +4 -0
- package/resources/reference.js.map +1 -1
- package/resources/schedule.d.ts +19 -0
- package/resources/schedule.d.ts.map +1 -0
- package/resources/schedule.js +96 -0
- package/resources/schedule.js.map +1 -0
- package/src/commands/list.ts +8 -5
- package/src/commands/resume.ts +8 -1
- package/src/commands/schedule.ts +70 -0
- package/src/program.ts +2 -0
- package/src/registry/metadata.ts +2 -0
- package/src/registry/registry.test.ts +113 -8
- package/src/registry/verb-support.ts +29 -21
- package/src/registry/verbs.ts +0 -1
- package/src/resources/apply/apply.integration.test.ts +132 -0
- package/src/resources/apply/apply.ts +16 -25
- package/src/resources/apply/handlers.ts +60 -150
- package/src/resources/delete.ts +8 -4
- package/src/resources/execution.ts +20 -6
- package/src/resources/get-bindings.ts +8 -1
- package/src/resources/list.ts +107 -31
- package/src/resources/mutate-verbs.integration.test.ts +78 -4
- package/src/resources/read-verbs.integration.test.ts +124 -5
- package/src/resources/reference.ts +5 -0
- package/src/resources/schedule.ts +115 -0
package/resources/list.js
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Most registry kinds are search-indexed and list through the unified
|
|
4
4
|
// SearchService. Kinds that are deliberately not search-indexed
|
|
5
|
-
// (organizations, API keys, agent instances, agent channels, channel apps
|
|
6
|
-
// use their dedicated find/list RPCs with bespoke table shapes
|
|
5
|
+
// (organizations, API keys, agent instances, agent channels, channel apps,
|
|
6
|
+
// schedules) use their dedicated find/list RPCs with bespoke table shapes,
|
|
7
|
+
// registered in LIST_HANDLERS — the same map-dispatch shape as the get,
|
|
8
|
+
// delete, and apply registries, so the conformance test in
|
|
9
|
+
// registry/registry.test.ts can hold all four to the verb matrix.
|
|
7
10
|
import { create } from "@bufbuild/protobuf";
|
|
8
11
|
import { AgentChannelSchema } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/api_pb";
|
|
9
12
|
import { ListAgentChannelsRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/io_pb";
|
|
@@ -11,6 +14,8 @@ import { AgentInstanceSchema } from "@stigmer/protos/ai/stigmer/agentic/agentins
|
|
|
11
14
|
import { ListAgentInstancesRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/io_pb";
|
|
12
15
|
import { ChannelAppSchema } from "@stigmer/protos/ai/stigmer/agentic/channelapp/v1/api_pb";
|
|
13
16
|
import { ListChannelAppsByOrgInputSchema } from "@stigmer/protos/ai/stigmer/agentic/channelapp/v1/io_pb";
|
|
17
|
+
import { ScheduleSchema } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/api_pb";
|
|
18
|
+
import { ListSchedulesRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/io_pb";
|
|
14
19
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
15
20
|
import { PageInfoSchema } from "@stigmer/protos/ai/stigmer/commons/rpc/pagination_pb";
|
|
16
21
|
import { ApiKeySchema } from "@stigmer/protos/ai/stigmer/iam/apikey/v1/api_pb";
|
|
@@ -22,9 +27,9 @@ import { bool, obj, renderCollection, str } from "./render.js";
|
|
|
22
27
|
// scope). Must stay in step with the server's SearchableKinds allowlist
|
|
23
28
|
// (backend/services/stigmer-server/pkg/query/search/valueobject/
|
|
24
29
|
// search_criteria.go): a kind present here but absent there silently lists
|
|
25
|
-
// as empty.
|
|
26
|
-
//
|
|
27
|
-
const SEARCH_KINDS = new Set([
|
|
30
|
+
// as empty. The LIST_HANDLERS kinds are deliberately NOT here — they are
|
|
31
|
+
// not_search_indexed by design and take dedicated-RPC handlers below.
|
|
32
|
+
export const SEARCH_KINDS = new Set([
|
|
28
33
|
ApiResourceKind.agent,
|
|
29
34
|
ApiResourceKind.workflow,
|
|
30
35
|
ApiResourceKind.mcp_server,
|
|
@@ -33,29 +38,66 @@ const SEARCH_KINDS = new Set([
|
|
|
33
38
|
ApiResourceKind.datastore,
|
|
34
39
|
ApiResourceKind.environment,
|
|
35
40
|
]);
|
|
41
|
+
// Dedicated-RPC list handlers for the non-search-indexed kinds. Every kind
|
|
42
|
+
// declaring List in the verb matrix must appear here or in SEARCH_KINDS —
|
|
43
|
+
// the conformance test enforces it, so the two cannot drift.
|
|
44
|
+
export const LIST_HANDLERS = new Map([
|
|
45
|
+
[
|
|
46
|
+
ApiResourceKind.organization,
|
|
47
|
+
async (client, _org, _limit, format) => {
|
|
48
|
+
const result = await client.organization.findMyOrganizations();
|
|
49
|
+
return renderCollection(OrganizationSchema, result.entries, format, ORG_TABLE);
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
ApiResourceKind.api_key,
|
|
54
|
+
async (client, _org, _limit, format) => {
|
|
55
|
+
const result = await client.apiKey.findAll();
|
|
56
|
+
return renderCollection(ApiKeySchema, result.entries, format, APIKEY_TABLE);
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
ApiResourceKind.agent_instance,
|
|
61
|
+
async (client, org, limit, format) => {
|
|
62
|
+
const result = await client.agentInstance.list(create(ListAgentInstancesRequestSchema, { org, pageInfo: create(PageInfoSchema, { num: 1, size: limit }) }));
|
|
63
|
+
return renderCollection(AgentInstanceSchema, result.items, format, INSTANCE_TABLE);
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
ApiResourceKind.agent_channel,
|
|
68
|
+
async (client, org, limit, format) => {
|
|
69
|
+
const result = await client.agentChannel.list(create(ListAgentChannelsRequestSchema, { org, pageInfo: create(PageInfoSchema, { num: 1, size: limit }) }));
|
|
70
|
+
return renderCollection(AgentChannelSchema, result.items, format, AGENT_CHANNEL_TABLE);
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
ApiResourceKind.channel_app,
|
|
75
|
+
async (client, org, limit, format) => {
|
|
76
|
+
// listByOrg has no pagination on its contract (the per-org set is small
|
|
77
|
+
// by design); the limit is applied client-side so --limit stays honest.
|
|
78
|
+
// `channelapp` (not `channelApp`) is a recorded SDK codegen naming quirk.
|
|
79
|
+
const result = await client.channelapp.listByOrg(create(ListChannelAppsByOrgInputSchema, { org }));
|
|
80
|
+
return renderCollection(ChannelAppSchema, result.entries.slice(0, limit), format, CHANNEL_APP_TABLE);
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
ApiResourceKind.schedule,
|
|
85
|
+
async (client, org, limit, format) => {
|
|
86
|
+
// ListSchedulesRequest requires an org (min_len 1), but an unset cloud
|
|
87
|
+
// context resolves to "" — refuse with actionable copy instead of
|
|
88
|
+
// relaying the server's raw validation error.
|
|
89
|
+
if (org === "") {
|
|
90
|
+
throw new UsageError("schedules are org-scoped: pass --org <slug> or configure an organization context");
|
|
91
|
+
}
|
|
92
|
+
const result = await client.schedule.list(create(ListSchedulesRequestSchema, { org, pageInfo: create(PageInfoSchema, { num: 1, size: limit }) }));
|
|
93
|
+
return renderCollection(ScheduleSchema, result.items, format, SCHEDULE_TABLE);
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
]);
|
|
36
97
|
export async function listResources(client, kind, org, limit, format) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
if (kind === ApiResourceKind.api_key) {
|
|
42
|
-
const result = await client.apiKey.findAll();
|
|
43
|
-
return renderCollection(ApiKeySchema, result.entries, format, APIKEY_TABLE);
|
|
44
|
-
}
|
|
45
|
-
if (kind === ApiResourceKind.agent_instance) {
|
|
46
|
-
const result = await client.agentInstance.list(create(ListAgentInstancesRequestSchema, { org, pageInfo: create(PageInfoSchema, { num: 1, size: limit }) }));
|
|
47
|
-
return renderCollection(AgentInstanceSchema, result.items, format, INSTANCE_TABLE);
|
|
48
|
-
}
|
|
49
|
-
if (kind === ApiResourceKind.agent_channel) {
|
|
50
|
-
const result = await client.agentChannel.list(create(ListAgentChannelsRequestSchema, { org, pageInfo: create(PageInfoSchema, { num: 1, size: limit }) }));
|
|
51
|
-
return renderCollection(AgentChannelSchema, result.items, format, AGENT_CHANNEL_TABLE);
|
|
52
|
-
}
|
|
53
|
-
if (kind === ApiResourceKind.channel_app) {
|
|
54
|
-
// listByOrg has no pagination on its contract (the per-org set is small
|
|
55
|
-
// by design); the limit is applied client-side so --limit stays honest.
|
|
56
|
-
// `channelapp` (not `channelApp`) is a recorded SDK codegen naming quirk.
|
|
57
|
-
const result = await client.channelapp.listByOrg(create(ListChannelAppsByOrgInputSchema, { org }));
|
|
58
|
-
return renderCollection(ChannelAppSchema, result.entries.slice(0, limit), format, CHANNEL_APP_TABLE);
|
|
98
|
+
const dedicated = LIST_HANDLERS.get(kind);
|
|
99
|
+
if (dedicated !== undefined) {
|
|
100
|
+
return dedicated(client, org, limit, format);
|
|
59
101
|
}
|
|
60
102
|
if (!SEARCH_KINDS.has(kind)) {
|
|
61
103
|
throw new UsageError("list is not implemented for this resource type");
|
|
@@ -126,6 +168,32 @@ const CHANNEL_APP_TABLE = {
|
|
|
126
168
|
];
|
|
127
169
|
},
|
|
128
170
|
};
|
|
171
|
+
// ENABLED is the owner's switch (spec.enabled); STATE is the platform's
|
|
172
|
+
// failure latch, derived from status.paused_reason. They are different
|
|
173
|
+
// states with different remedies — re-apply with `enabled: true` versus
|
|
174
|
+
// `stigmer schedule resume` — so the table keeps them as two columns. An
|
|
175
|
+
// auto-paused schedule with ENABLED true is exactly the condition this
|
|
176
|
+
// surface exists to make visible (stigmer/stigmer#352).
|
|
177
|
+
const SCHEDULE_TABLE = {
|
|
178
|
+
resourceName: "schedules",
|
|
179
|
+
headers: ["ID", "SLUG", "TARGET", "CRON", "TZ", "ENABLED", "STATE"],
|
|
180
|
+
row: (json) => {
|
|
181
|
+
const metadata = obj(json, "metadata");
|
|
182
|
+
const spec = obj(json, "spec");
|
|
183
|
+
// The target oneof has one arm today (`agent`); a future workflow arm
|
|
184
|
+
// extends this accessor alongside the proto.
|
|
185
|
+
const agentRef = obj(obj(spec, "agent"), "agent_ref");
|
|
186
|
+
return [
|
|
187
|
+
str(metadata, "id"),
|
|
188
|
+
str(metadata, "slug"),
|
|
189
|
+
`${str(agentRef, "org")}/${str(agentRef, "slug")}`,
|
|
190
|
+
str(spec, "cron"),
|
|
191
|
+
str(spec, "time_zone"),
|
|
192
|
+
bool(spec, "enabled") ? "true" : "false",
|
|
193
|
+
str(obj(json, "status"), "paused_reason") === "" ? "active" : "paused",
|
|
194
|
+
];
|
|
195
|
+
},
|
|
196
|
+
};
|
|
129
197
|
// The provider_config oneof serializes as exactly one provider-named key in
|
|
130
198
|
// protojson (AgentChannelSpec and ChannelAppSpec share the same oneof
|
|
131
199
|
// shape). Extend this list when a new provider arm lands in the protos.
|
package/resources/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/resources/list.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,sEAAsE;AACtE,gEAAgE;AAChE,2EAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/resources/list.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,sEAAsE;AACtE,gEAAgE;AAChE,2EAA2E;AAC3E,2EAA2E;AAC3E,wEAAwE;AACxE,2DAA2D;AAC3D,kEAAkE;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC/F,OAAO,EAAE,8BAA8B,EAAE,MAAM,0DAA0D,CAAC;AAC1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AACjG,OAAO,EAAE,+BAA+B,EAAE,MAAM,2DAA2D,CAAC;AAC5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,yDAAyD,CAAC;AAC3F,OAAO,EAAE,+BAA+B,EAAE,MAAM,wDAAwD,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,0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
|
export declare function isWorkflowId(ref: string): boolean;
|
|
14
14
|
/** True if `ref` carries the session ID prefix (`ses_…`/`ses-…`). */
|
|
15
15
|
export declare function isSessionId(ref: string): boolean;
|
|
16
|
+
/** True if `ref` carries the schedule ID prefix (`sch_…`/`sch-…`). */
|
|
17
|
+
export declare function isScheduleId(ref: string): boolean;
|
|
16
18
|
/**
|
|
17
19
|
* True if `ref` starts with ANY known resource-ID prefix (length-agnostic).
|
|
18
20
|
* Mirrors Go's reference.HasResourceIDPrefix: use it to detect *intent* (the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/resources/reference.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,CAajG;AAqCD,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAe7D"}
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/resources/reference.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,CAajG;AAqCD,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAe7D"}
|
package/resources/reference.js
CHANGED
|
@@ -70,6 +70,10 @@ export function isWorkflowId(ref) {
|
|
|
70
70
|
export function isSessionId(ref) {
|
|
71
71
|
return hasKindPrefix(ref, idPrefixFor(ApiResourceKind.session));
|
|
72
72
|
}
|
|
73
|
+
/** True if `ref` carries the schedule ID prefix (`sch_…`/`sch-…`). */
|
|
74
|
+
export function isScheduleId(ref) {
|
|
75
|
+
return hasKindPrefix(ref, idPrefixFor(ApiResourceKind.schedule));
|
|
76
|
+
}
|
|
73
77
|
/**
|
|
74
78
|
* True if `ref` starts with ANY known resource-ID prefix (length-agnostic).
|
|
75
79
|
* Mirrors Go's reference.HasResourceIDPrefix: use it to detect *intent* (the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../src/resources/reference.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,uEAAuE;AACvE,EAAE;AACF,iCAAiC;AACjC,sDAAsD;AACtD,gEAAgE;AAChE,EAAE;AACF,gFAAgF;AAChF,2BAA2B;AAC3B,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,gEAAgE;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMjD,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,UAAkB,EAAE,QAAgB;IAC9E,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAE3B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;IACvF,CAAC;IAED,IAAI,QAAQ,KAAK,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,I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;IACf,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;YAAE,SAAS;QAC1D,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Stigmer } from "@stigmer/sdk";
|
|
2
|
+
import { CommandResult } from "../output/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve `ref` (a `sch_…` id, `org/slug`, or bare slug against `org`),
|
|
5
|
+
* clear its platform pause, and describe the outcome.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resumeSchedule(stigmer: Stigmer, ref: string, org: string): Promise<CommandResult>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve `ref` (a `sch_…` id, `org/slug`, or bare slug against `org`) and
|
|
10
|
+
* fire it once, immediately (project DD-014).
|
|
11
|
+
*
|
|
12
|
+
* The fire is asynchronous: the RPC answers with the schedule, and the run
|
|
13
|
+
* lands on status (last_fire_at / last_execution_id) as it starts — the
|
|
14
|
+
* same observability contract cron fires have. Disabled and platform-paused
|
|
15
|
+
* schedules are refused by the server with teaching copy; the CLI relays
|
|
16
|
+
* the server's message verbatim (never pattern-match refusal text).
|
|
17
|
+
*/
|
|
18
|
+
export declare function triggerSchedule(stigmer: Stigmer, ref: string, org: string): Promise<CommandResult>;
|
|
19
|
+
//# sourceMappingURL=schedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../src/resources/schedule.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAavG;AAeD;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAqBxG"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// `schedule resume` dispatch: clear a platform auto-pause from a schedule
|
|
2
|
+
// and report what was cleared.
|
|
3
|
+
//
|
|
4
|
+
// "Paused" is the platform's latch (status.paused_reason, written after
|
|
5
|
+
// repeated failed runs), distinct from "disabled", the owner's switch
|
|
6
|
+
// (spec.enabled) — two words, two levers (see docs/vocabulary.md). The
|
|
7
|
+
// resume RPC is deliberately the only path that clears the latch: applying
|
|
8
|
+
// a manifest preserves status verbatim, so no declarative workflow can
|
|
9
|
+
// silently un-pause a failing schedule.
|
|
10
|
+
//
|
|
11
|
+
// The pre-state read exists for honest messaging only: the RPC is
|
|
12
|
+
// idempotent and its response always shows a cleared latch, so "resumed"
|
|
13
|
+
// versus "was not paused" can only be told apart by looking first. The
|
|
14
|
+
// resume call is made either way — on the no-op path it doubles as a
|
|
15
|
+
// harmless re-arm of the schedule's clock.
|
|
16
|
+
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
17
|
+
import { UsageError } from "../errors/index.js";
|
|
18
|
+
import { CommandResult } from "../output/index.js";
|
|
19
|
+
import { parseReference } from "./reference.js";
|
|
20
|
+
/** The schedule kind's canonical id prefix (proto kind_meta). */
|
|
21
|
+
const SCHEDULE_ID_PREFIX = "sch";
|
|
22
|
+
/**
|
|
23
|
+
* Resolve `ref` (a `sch_…` id, `org/slug`, or bare slug against `org`),
|
|
24
|
+
* clear its platform pause, and describe the outcome.
|
|
25
|
+
*/
|
|
26
|
+
export async function resumeSchedule(stigmer, ref, org) {
|
|
27
|
+
const before = await loadSchedule(stigmer, ref, org);
|
|
28
|
+
const id = before.metadata?.id ?? "";
|
|
29
|
+
if (id === "") {
|
|
30
|
+
throw new UsageError(`Schedule '${ref}' has no id — cannot resume`);
|
|
31
|
+
}
|
|
32
|
+
const wasPausedReason = before.status?.pausedReason ?? "";
|
|
33
|
+
const wasFailures = before.status?.consecutiveFailures ?? 0;
|
|
34
|
+
const resumed = await stigmer.schedule.resume(id);
|
|
35
|
+
return describeOutcome(resumed, wasPausedReason, wasFailures);
|
|
36
|
+
}
|
|
37
|
+
async function loadSchedule(stigmer, ref, org) {
|
|
38
|
+
const parsed = parseReference(ref, org, SCHEDULE_ID_PREFIX);
|
|
39
|
+
if (parsed.kind === "id") {
|
|
40
|
+
return stigmer.schedule.get(parsed.id);
|
|
41
|
+
}
|
|
42
|
+
if (parsed.org === "") {
|
|
43
|
+
throw new UsageError("organization not set\n\nSet it with:\n stigmer config context set --org <org>\n stigmer schedule resume --org <org> ...");
|
|
44
|
+
}
|
|
45
|
+
return stigmer.schedule.getByReference({ org: parsed.org, slug: parsed.slug });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve `ref` (a `sch_…` id, `org/slug`, or bare slug against `org`) and
|
|
49
|
+
* fire it once, immediately (project DD-014).
|
|
50
|
+
*
|
|
51
|
+
* The fire is asynchronous: the RPC answers with the schedule, and the run
|
|
52
|
+
* lands on status (last_fire_at / last_execution_id) as it starts — the
|
|
53
|
+
* same observability contract cron fires have. Disabled and platform-paused
|
|
54
|
+
* schedules are refused by the server with teaching copy; the CLI relays
|
|
55
|
+
* the server's message verbatim (never pattern-match refusal text).
|
|
56
|
+
*/
|
|
57
|
+
export async function triggerSchedule(stigmer, ref, org) {
|
|
58
|
+
const before = await loadSchedule(stigmer, ref, org);
|
|
59
|
+
const id = before.metadata?.id ?? "";
|
|
60
|
+
if (id === "") {
|
|
61
|
+
throw new UsageError(`Schedule '${ref}' has no id — cannot trigger`);
|
|
62
|
+
}
|
|
63
|
+
const triggered = await stigmer.schedule.trigger(id);
|
|
64
|
+
const slug = triggered.metadata?.slug ?? "";
|
|
65
|
+
const name = triggered.metadata?.name || slug;
|
|
66
|
+
const result = CommandResult.success(`Schedule '${name}' triggered — a run is starting`);
|
|
67
|
+
const section = result.addSection();
|
|
68
|
+
const orgSlug = triggered.metadata?.org ? `${triggered.metadata.org}/${slug}` : slug;
|
|
69
|
+
section.field("Watch it land", `stigmer get schedule ${orgSlug} (status.last_execution_id)`);
|
|
70
|
+
if (triggered.status?.nextFireAt !== undefined) {
|
|
71
|
+
section.field("Next cron fire", timestampDate(triggered.status.nextFireAt).toISOString());
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
function describeOutcome(schedule, wasPausedReason, wasFailures) {
|
|
76
|
+
const slug = schedule.metadata?.slug ?? "";
|
|
77
|
+
const name = schedule.metadata?.name || slug;
|
|
78
|
+
const wasPaused = wasPausedReason !== "" || wasFailures > 0;
|
|
79
|
+
const result = CommandResult.success(wasPaused ? `Schedule '${name}' resumed` : `Schedule '${name}' was not paused — nothing to clear`);
|
|
80
|
+
if (wasPaused) {
|
|
81
|
+
const section = result.addSection("Cleared");
|
|
82
|
+
if (wasPausedReason !== "")
|
|
83
|
+
section.field("Pause reason", wasPausedReason);
|
|
84
|
+
if (wasFailures > 0)
|
|
85
|
+
section.field("Consecutive failures", String(wasFailures));
|
|
86
|
+
}
|
|
87
|
+
if (schedule.spec?.enabled !== true) {
|
|
88
|
+
result.hint("This schedule is disabled (enabled: false) — it will not fire until you enable it:");
|
|
89
|
+
result.hint(` edit the manifest to 'enabled: true' and run: stigmer apply -f <file>`);
|
|
90
|
+
}
|
|
91
|
+
else if (schedule.status?.nextFireAt !== undefined) {
|
|
92
|
+
result.addSection().field("Next fire", timestampDate(schedule.status.nextFireAt).toISOString());
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=schedule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../src/resources/schedule.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,+BAA+B;AAC/B,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,uEAAuE;AACvE,2EAA2E;AAC3E,uEAAuE;AACvE,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,yEAAyE;AACzE,uEAAuE;AACvE,qEAAqE;AACrE,2CAA2C;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,iEAAiE;AACjE,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAgB,EAAE,GAAW,EAAE,GAAW;IAC7E,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACrD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC;IACrC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACd,MAAM,IAAI,UAAU,CAAC,aAAa,GAAG,6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Aa,IAAI,WAAW,CAAC,CAAC,CAAC,aAAa,IAAI,qCAAqC,CAClG,CAAC;IAEF,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,eAAe,KAAK,EAAE;YAAE,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QAC3E,IAAI,WAAW,GAAG,CAAC;YAAE,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,oFAAoF,CAAC,CAAC;QAClG,MAAM,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;IACzF,CAAC;SAAM,IAAI,QAAQ,CAAC,MAAM,EAAE,UAAU,KAAK,SAAS,EAAE,CAAC;QACrD,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/src/commands/list.ts
CHANGED
|
@@ -38,7 +38,7 @@ async function runList(type: string, options: ListFlags, command: Command): Prom
|
|
|
38
38
|
const { isExecutionAlias } = await import("../resources/execution.js");
|
|
39
39
|
const { isSessionAlias } = await import("../resources/session.js");
|
|
40
40
|
if (isExecutionAlias(type)) {
|
|
41
|
-
await runListExecutions(options);
|
|
41
|
+
await runListExecutions(options, command);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
if (isSessionAlias(type)) {
|
|
@@ -67,8 +67,10 @@ async function runList(type: string, options: ListFlags, command: Command): Prom
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// Executions bypass the registry: they're listed by their own controllers and
|
|
70
|
-
// optionally filtered to agent (default) or workflow by `--type`.
|
|
71
|
-
|
|
70
|
+
// optionally filtered to agent (default) or workflow by `--type`. Results are
|
|
71
|
+
// scoped to the resolved org context (--org flag, env, or configured context);
|
|
72
|
+
// an unset cloud context resolves to "" = permission-bounded across orgs.
|
|
73
|
+
async function runListExecutions(options: ListFlags, command: Command): Promise<void> {
|
|
72
74
|
const [{ connectBackend }, execution] = await Promise.all([
|
|
73
75
|
import("../backend.js"),
|
|
74
76
|
import("../resources/execution.js"),
|
|
@@ -76,19 +78,20 @@ async function runListExecutions(options: ListFlags): Promise<void> {
|
|
|
76
78
|
|
|
77
79
|
const client = connectBackend();
|
|
78
80
|
ensureAuthenticated(client.config);
|
|
81
|
+
const org = resolveOrganization(client.config, globalOrg(command));
|
|
79
82
|
const limit = parseLimit(options.limit);
|
|
80
83
|
const format = readFormat(options);
|
|
81
84
|
|
|
82
85
|
const filter = (options.type ?? "").trim().toLowerCase();
|
|
83
86
|
if (filter === "workflow" || filter === "wf") {
|
|
84
|
-
const result = await execution.listWorkflowExecutions(client.stigmer, limit);
|
|
87
|
+
const result = await execution.listWorkflowExecutions(client.stigmer, limit, org);
|
|
85
88
|
process.stdout.write(execution.renderExecutionList(result, format, "workflow"));
|
|
86
89
|
return;
|
|
87
90
|
}
|
|
88
91
|
if (filter !== "" && filter !== "agent") {
|
|
89
92
|
throw new UsageError(`unknown execution type filter: ${options.type}\n\nValid values: agent, workflow`);
|
|
90
93
|
}
|
|
91
|
-
const result = await execution.listAgentExecutions(client.stigmer, limit);
|
|
94
|
+
const result = await execution.listAgentExecutions(client.stigmer, limit, org);
|
|
92
95
|
process.stdout.write(execution.renderExecutionList(result, format, "agent"));
|
|
93
96
|
}
|
|
94
97
|
|
package/src/commands/resume.ts
CHANGED
|
@@ -55,7 +55,7 @@ async function runResume(reference: string | undefined, options: ResumeFlags, co
|
|
|
55
55
|
throw browseUnavailableError();
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const { isSessionId, isAgentId, isWorkflowId, hasResourceIdPrefix, validateResourceId } = await import(
|
|
58
|
+
const { isSessionId, isAgentId, isWorkflowId, isScheduleId, hasResourceIdPrefix, validateResourceId } = await import(
|
|
59
59
|
"../resources/reference.js"
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -64,6 +64,13 @@ async function runResume(reference: string | undefined, options: ResumeFlags, co
|
|
|
64
64
|
throw new UsageError(`Resource IDs like "${reference}" are not sessions\n\nTo run a resource:\n stigmer run ${reference}`);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
// Schedule IDs belong to `schedule resume` (clearing a platform pause).
|
|
68
|
+
if (isScheduleId(reference)) {
|
|
69
|
+
throw new UsageError(
|
|
70
|
+
`Resource IDs like "${reference}" are not sessions\n\nTo resume a paused schedule:\n stigmer schedule resume ${reference}`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
67
74
|
if (isSessionId(reference)) {
|
|
68
75
|
if (validateResourceId(reference) !== null) {
|
|
69
76
|
throw new UsageError(
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// `stigmer schedule resume <ref>` — clear a platform auto-pause from a
|
|
2
|
+
// schedule. `stigmer schedule trigger <ref>` — fire it once, immediately.
|
|
3
|
+
//
|
|
4
|
+
// The platform pauses a schedule after repeated failed runs and records
|
|
5
|
+
// why in status.paused_reason; resume is the owner's explicit act that
|
|
6
|
+
// clears it (the owner's enabled switch is a different lever — see
|
|
7
|
+
// docs/vocabulary.md, "Disabled vs. paused"). Trigger fires the schedule
|
|
8
|
+
// through its own clock (DD-014), so everything a cron fire does applies
|
|
9
|
+
// — including feeding the failure streak. Declarative verbs stay in the
|
|
10
|
+
// generic matrix (apply/get/list/delete); this group exists for the
|
|
11
|
+
// kind-specific operational actions, the `stigmer share` shape.
|
|
12
|
+
//
|
|
13
|
+
// Thin handler: resolve credentials/org, delegate to resources/schedule,
|
|
14
|
+
// render the result. Heavy modules are lazy-imported so `--help` stays
|
|
15
|
+
// fast (DD-001).
|
|
16
|
+
|
|
17
|
+
import type { Command } from "commander";
|
|
18
|
+
import { ensureAuthenticated, resolveOrganization } from "../config/index.js";
|
|
19
|
+
import type { OutputFlags } from "../output/index.js";
|
|
20
|
+
import { addResultFlags, globalOrg, resultFormat } from "./shared.js";
|
|
21
|
+
|
|
22
|
+
export function registerSchedule(program: Command): void {
|
|
23
|
+
const schedule = program.command("schedule").description("operate on schedules");
|
|
24
|
+
|
|
25
|
+
const resume = schedule
|
|
26
|
+
.command("resume <ref>")
|
|
27
|
+
.description("clear a platform pause so a schedule fires again (id, org/slug, or slug)")
|
|
28
|
+
.action((ref: string, options: OutputFlags, command: Command) => runScheduleResume(ref, options, command));
|
|
29
|
+
addResultFlags(resume);
|
|
30
|
+
|
|
31
|
+
const trigger = schedule
|
|
32
|
+
.command("trigger <ref>")
|
|
33
|
+
.description("fire a schedule once, immediately (id, org/slug, or slug)")
|
|
34
|
+
.action((ref: string, options: OutputFlags, command: Command) => runScheduleTrigger(ref, options, command));
|
|
35
|
+
addResultFlags(trigger);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function runScheduleTrigger(ref: string, options: OutputFlags, command: Command): Promise<void> {
|
|
39
|
+
const format = resultFormat(options);
|
|
40
|
+
|
|
41
|
+
const [{ connectBackend }, { triggerSchedule }, { renderResult }] = await Promise.all([
|
|
42
|
+
import("../backend.js"),
|
|
43
|
+
import("../resources/schedule.js"),
|
|
44
|
+
import("../output/command-result.js"),
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
const client = connectBackend();
|
|
48
|
+
ensureAuthenticated(client.config);
|
|
49
|
+
const org = resolveOrganization(client.config, globalOrg(command));
|
|
50
|
+
|
|
51
|
+
const result = await triggerSchedule(client.stigmer, ref, org);
|
|
52
|
+
renderResult(result, format);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function runScheduleResume(ref: string, options: OutputFlags, command: Command): Promise<void> {
|
|
56
|
+
const format = resultFormat(options);
|
|
57
|
+
|
|
58
|
+
const [{ connectBackend }, { resumeSchedule }, { renderResult }] = await Promise.all([
|
|
59
|
+
import("../backend.js"),
|
|
60
|
+
import("../resources/schedule.js"),
|
|
61
|
+
import("../output/command-result.js"),
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
const client = connectBackend();
|
|
65
|
+
ensureAuthenticated(client.config);
|
|
66
|
+
const org = resolveOrganization(client.config, globalOrg(command));
|
|
67
|
+
|
|
68
|
+
const result = await resumeSchedule(client.stigmer, ref, org);
|
|
69
|
+
renderResult(result, format);
|
|
70
|
+
}
|
package/src/program.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { registerPush } from "./commands/push.js";
|
|
|
28
28
|
import { registerReset } from "./commands/reset.js";
|
|
29
29
|
import { registerResume } from "./commands/resume.js";
|
|
30
30
|
import { registerRun } from "./commands/run.js";
|
|
31
|
+
import { registerSchedule } from "./commands/schedule.js";
|
|
31
32
|
import { registerSearch } from "./commands/search.js";
|
|
32
33
|
import { registerSeedpack } from "./commands/seedpack.js";
|
|
33
34
|
import { registerSetup } from "./commands/setup.js";
|
|
@@ -78,6 +79,7 @@ export function buildProgram(): Command {
|
|
|
78
79
|
registerDelete(program);
|
|
79
80
|
registerTag(program);
|
|
80
81
|
registerShare(program);
|
|
82
|
+
registerSchedule(program);
|
|
81
83
|
registerDiff(program);
|
|
82
84
|
registerUsage(program);
|
|
83
85
|
registerPush(program);
|
package/src/registry/metadata.ts
CHANGED
|
@@ -36,6 +36,7 @@ export const KIND_META: ReadonlyMap<ApiResourceKind, KindMeta> = new Map([
|
|
|
36
36
|
[ApiResourceKind.agent_channel, { name: "AgentChannel", displayName: "Agent Channel", idPrefix: "ach" }],
|
|
37
37
|
[ApiResourceKind.channel_app, { name: "ChannelApp", displayName: "Channel App", idPrefix: "chapp" }],
|
|
38
38
|
[ApiResourceKind.datastore, { name: "Datastore", displayName: "Datastore", idPrefix: "dst" }],
|
|
39
|
+
[ApiResourceKind.schedule, { name: "Schedule", displayName: "Schedule", idPrefix: "sch" }],
|
|
39
40
|
[ApiResourceKind.agent_instance, { name: "AgentInstance", displayName: "Agent Instance", idPrefix: "ain" }],
|
|
40
41
|
[ApiResourceKind.workflow_instance, { name: "WorkflowInstance", displayName: "Workflow Instance", idPrefix: "win" }],
|
|
41
42
|
[ApiResourceKind.session, { name: "Session", displayName: "Session", idPrefix: "ses" }],
|
|
@@ -62,6 +63,7 @@ export const CLI_RELEVANT_KINDS: readonly ApiResourceKind[] = [
|
|
|
62
63
|
ApiResourceKind.agent_channel,
|
|
63
64
|
ApiResourceKind.channel_app,
|
|
64
65
|
ApiResourceKind.datastore,
|
|
66
|
+
ApiResourceKind.schedule,
|
|
65
67
|
ApiResourceKind.agent_instance,
|
|
66
68
|
ApiResourceKind.workflow_instance,
|
|
67
69
|
ApiResourceKind.session,
|