@owlmeans/viable-sdk 0.1.18-rc.16 → 0.1.18-rc.18
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/build/api/remote.d.ts +5 -0
- package/build/api/remote.d.ts.map +1 -1
- package/build/api/remote.js +7 -17
- package/build/api/remote.js.map +1 -1
- package/build/consts.d.ts +13 -0
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +13 -0
- package/build/consts.js.map +1 -1
- package/build/context/index.d.ts.map +1 -1
- package/build/context/index.js +45 -3
- package/build/context/index.js.map +1 -1
- package/build/harness/templates.js +1 -1
- package/build/tools/catalogue.d.ts.map +1 -1
- package/build/tools/catalogue.js +93 -26
- package/build/tools/catalogue.js.map +1 -1
- package/build/tools/index.d.ts +1 -0
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +1 -0
- package/build/tools/index.js.map +1 -1
- package/build/tools/mcp.d.ts.map +1 -1
- package/build/tools/mcp.js +3 -0
- package/build/tools/mcp.js.map +1 -1
- package/build/tools/platform.d.ts.map +1 -1
- package/build/tools/platform.js +3 -1
- package/build/tools/platform.js.map +1 -1
- package/build/tools/refusal.d.ts.map +1 -1
- package/build/tools/refusal.js +46 -0
- package/build/tools/refusal.js.map +1 -1
- package/build/tools/stories.d.ts +39 -0
- package/build/tools/stories.d.ts.map +1 -0
- package/build/tools/stories.js +81 -0
- package/build/tools/stories.js.map +1 -0
- package/build/types.d.ts +12 -16
- package/build/types.d.ts.map +1 -1
- package/package.json +5 -2
package/build/api/remote.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ export declare const recoverLongPoll: <T>(poll: () => Promise<T>, snapshot: () =
|
|
|
18
18
|
* tool that outlives its host's ceiling is reported to the user as a broken server, and the true
|
|
19
19
|
* answer — the platform was slow — never reaches them. Anything that legitimately takes longer is
|
|
20
20
|
* a job, and a job returns at once.
|
|
21
|
+
*
|
|
22
|
+
* `planning` is the facade `makeSdkContext` registered with `appendPlanningClient`: its reads and
|
|
23
|
+
* its execute POST carry the same tool deadline, and a commit is awaited by long polls whose HTTP
|
|
24
|
+
* deadline outlasts their own hold by ten seconds. Its scope is empty on purpose — the platform
|
|
25
|
+
* reads the organization and the profile from the token.
|
|
21
26
|
*/
|
|
22
27
|
export declare const makeRemoteConnectorApi: (context: Ctx) => ConnectorApi;
|
|
23
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/api/remote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAS3E,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/api/remote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAS3E,OAAO,KAAK,EAAE,YAAY,EAAiC,MAAM,aAAa,CAAA;AAE9E,KAAK,GAAG,GAAG,aAAa,CAAC,YAAY,CAAC,CAAA;AAOtC,4FAA4F;AAC5F,eAAO,MAAM,yBAAyB,UAAW,OAAO,KAAG,OAgB1D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAU,CAAC,QAC/B,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,MAAM,OAAO,CAAC,CAAC,CAAC,KACjD,OAAO,CAAC,CAAC,CAQX,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,YAAa,GAAG,KAAG,YAuHrD,CAAA"}
|
package/build/api/remote.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { planningOf } from '@owlmeans/client-planning';
|
|
1
2
|
import { connectRef } from '@owlmeans/viable-common';
|
|
2
3
|
import { TOOL_DEADLINE_MS } from '../consts.js';
|
|
3
4
|
const TRANSIENT_TRANSPORT_CODES = new Set([
|
|
@@ -45,6 +46,11 @@ export const recoverLongPoll = async (poll, snapshot) => {
|
|
|
45
46
|
* tool that outlives its host's ceiling is reported to the user as a broken server, and the true
|
|
46
47
|
* answer — the platform was slow — never reaches them. Anything that legitimately takes longer is
|
|
47
48
|
* a job, and a job returns at once.
|
|
49
|
+
*
|
|
50
|
+
* `planning` is the facade `makeSdkContext` registered with `appendPlanningClient`: its reads and
|
|
51
|
+
* its execute POST carry the same tool deadline, and a commit is awaited by long polls whose HTTP
|
|
52
|
+
* deadline outlasts their own hold by ten seconds. Its scope is empty on purpose — the platform
|
|
53
|
+
* reads the organization and the profile from the token.
|
|
48
54
|
*/
|
|
49
55
|
export const makeRemoteConnectorApi = (context) => {
|
|
50
56
|
return {
|
|
@@ -105,23 +111,7 @@ export const makeRemoteConnectorApi = (context) => {
|
|
|
105
111
|
: await recoverLongPoll(async () => await read(waitSec), async () => await read(0));
|
|
106
112
|
},
|
|
107
113
|
},
|
|
108
|
-
|
|
109
|
-
list: async (id, query) => await context.entrypoint(connectRef.story.list).call({
|
|
110
|
-
params: { id }, query: query ?? {}, timeout: TOOL_DEADLINE_MS,
|
|
111
|
-
}),
|
|
112
|
-
get: async (id, storyId) => await context
|
|
113
|
-
.entrypoint(connectRef.story.get).call({ params: { id, storyId }, timeout: TOOL_DEADLINE_MS }),
|
|
114
|
-
create: async (id, story) => await context
|
|
115
|
-
.entrypoint(connectRef.story.create).call({ params: { id }, body: { story }, timeout: TOOL_DEADLINE_MS }),
|
|
116
|
-
update: async (id, storyId, story) => await context.entrypoint(connectRef.story.update).call({
|
|
117
|
-
params: { id, storyId }, body: { story }, timeout: TOOL_DEADLINE_MS,
|
|
118
|
-
}),
|
|
119
|
-
remove: async (id, storyId) => await context
|
|
120
|
-
.entrypoint(connectRef.story.delete).call({ params: { id, storyId }, timeout: TOOL_DEADLINE_MS }),
|
|
121
|
-
develop: async (id, storyId) => await context.entrypoint(connectRef.story.develop).call({
|
|
122
|
-
params: { id, storyId }, timeout: TOOL_DEADLINE_MS,
|
|
123
|
-
}),
|
|
124
|
-
},
|
|
114
|
+
planning: planningOf(context, {}),
|
|
125
115
|
files: {
|
|
126
116
|
list: async (id) => await context.entrypoint(connectRef.files.list).call({
|
|
127
117
|
params: { id }, timeout: TOOL_DEADLINE_MS,
|
package/build/api/remote.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/api/remote.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/api/remote.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAMpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAK/C,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,yBAAyB;IAC7E,yBAAyB,EAAE,gBAAgB;CAC5C,CAAC,CAAA;AAEF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAc,EAAW,EAAE;IACnE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAW,CAAA;IAC/B,IAAI,OAAO,GAAY,KAAK,CAAA;IAE5B,OAAO,OAAO,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACjB,MAAM,KAAK,GAAG,OAAiE,CAAA;QAC/E,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,yBAAyB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QAC5F,MAAM,OAAO,GAAG,OAAO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SAAiB,EAAE,MAA4B,EAAE,EAAE;YAC5E,0FAA0F;YAC1F,qEAAqE;YACrE,MAAM,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;gBACvD,MAAM,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,gBAAgB;aACrF,CAAC;SACL;KACF,CAAA;AACH,CAAC,CAAA"}
|
package/build/consts.d.ts
CHANGED
|
@@ -25,6 +25,19 @@ export declare const TOOL_DEADLINE_MS = 45000;
|
|
|
25
25
|
* was given failed on every poll that ran the full window.
|
|
26
26
|
*/
|
|
27
27
|
export declare const JOB_POLL_MAX_SEC = 30;
|
|
28
|
+
/**
|
|
29
|
+
* How long a story tool waits for its planning transition to COMMIT, in milliseconds.
|
|
30
|
+
*
|
|
31
|
+
* Well under {@link TOOL_DEADLINE_MS}: the same call has already resolved the story and posted the
|
|
32
|
+
* transition, and on the platform a person's narrative is re-formatted by a model before it is
|
|
33
|
+
* appended. A commit that is late is not a failure — the transition is durable and nothing is
|
|
34
|
+
* undone — so `develop_story` answers from the job row instead of waiting out the host's ceiling.
|
|
35
|
+
*/
|
|
36
|
+
export declare const COMMIT_WAIT_MS = 20000;
|
|
37
|
+
/** How long one long poll of a commit may hold, in seconds — what the platform holds at most for a connector. */
|
|
38
|
+
export declare const COMMIT_POLL_SEC = 20;
|
|
39
|
+
/** How many stories one page of `list_stories` carries when the caller names no size. */
|
|
40
|
+
export declare const STORY_PAGE_SIZE = 25;
|
|
28
41
|
/** How long `next_task` waits before answering "nothing yet". Under every host's ceiling. */
|
|
29
42
|
export declare const NEXT_TASK_WAIT_MS = 30000;
|
|
30
43
|
/**
|
package/build/consts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],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,CAAA;AAElC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,QAAS,CAAA;AAEpC,iHAAiH;AACjH,eAAO,MAAM,eAAe,KAAK,CAAA;AAEjC,yFAAyF;AACzF,eAAO,MAAM,eAAe,KAAK,CAAA;AAEjC,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,QAAS,CAAA;AAEvC;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAA;AAE3C,qEAAqE;AACrE,eAAO,MAAM,YAAY,QAAS,CAAA;AAElC,uFAAuF;AACvF,eAAO,MAAM,gBAAgB,QAAS,CAAA;AAEtC,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,QAAS,CAAA;AAEzC,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,UAAwC,CAAA"}
|
package/build/consts.js
CHANGED
|
@@ -25,6 +25,19 @@ export const TOOL_DEADLINE_MS = 45_000;
|
|
|
25
25
|
* was given failed on every poll that ran the full window.
|
|
26
26
|
*/
|
|
27
27
|
export const JOB_POLL_MAX_SEC = 30;
|
|
28
|
+
/**
|
|
29
|
+
* How long a story tool waits for its planning transition to COMMIT, in milliseconds.
|
|
30
|
+
*
|
|
31
|
+
* Well under {@link TOOL_DEADLINE_MS}: the same call has already resolved the story and posted the
|
|
32
|
+
* transition, and on the platform a person's narrative is re-formatted by a model before it is
|
|
33
|
+
* appended. A commit that is late is not a failure — the transition is durable and nothing is
|
|
34
|
+
* undone — so `develop_story` answers from the job row instead of waiting out the host's ceiling.
|
|
35
|
+
*/
|
|
36
|
+
export const COMMIT_WAIT_MS = 20_000;
|
|
37
|
+
/** How long one long poll of a commit may hold, in seconds — what the platform holds at most for a connector. */
|
|
38
|
+
export const COMMIT_POLL_SEC = 20;
|
|
39
|
+
/** How many stories one page of `list_stories` carries when the caller names no size. */
|
|
40
|
+
export const STORY_PAGE_SIZE = 25;
|
|
28
41
|
/** How long `next_task` waits before answering "nothing yet". Under every host's ceiling. */
|
|
29
42
|
export const NEXT_TASK_WAIT_MS = 30_000;
|
|
30
43
|
/**
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAA;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAA;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAA;AACzC,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAA;AACnC,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAA;AAC3C,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAA;AAEnD,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAA;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAEtC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAElC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAA;AAE3C,qEAAqE;AACrE,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAA;AAElC,uFAAuF;AACvF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAEtC,yFAAyF;AACzF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAA;AAEzC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAA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":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAU3E,OAAO,EAAE,OAAO,EAA0C,MAAM,yBAAyB,CAAA;AAkCzF,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,SAAgB,iBAAiB,KAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAwFjG,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/build/context/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { AppType } from '@owlmeans/context';
|
|
2
2
|
import { makeClientContext } from '@owlmeans/client-context';
|
|
3
3
|
import { bind } from '@owlmeans/client-entrypoint';
|
|
4
|
+
import { appendPlanningClient } from '@owlmeans/client-planning';
|
|
4
5
|
import { openProtocol, protocols } from '@owlmeans/entrypoint';
|
|
6
|
+
import { makePlanningProtocols } from '@owlmeans/planning';
|
|
5
7
|
import { route } from '@owlmeans/route';
|
|
6
8
|
import { authMiddleware, DEFAULT_GUARD } from '@owlmeans/auth-common';
|
|
7
9
|
import { makeTokenCarrierGuard } from '@owlmeans/auth-token';
|
|
8
10
|
import { connect, connectProtocols, CONNECT_TOKEN_PREFIX } from '@owlmeans/viable-common';
|
|
9
|
-
import { SDK_SERVICE } from '../consts.js';
|
|
11
|
+
import { COMMIT_POLL_SEC, SDK_SERVICE, TOOL_DEADLINE_MS } from '../consts.js';
|
|
10
12
|
import { SdkAuthError, SdkMisconfigured } from '../errors.js';
|
|
11
13
|
/**
|
|
12
14
|
* The platform's websocket namespace, which the connector's socket route is declared under.
|
|
@@ -16,6 +18,25 @@ import { SdkAuthError, SdkMisconfigured } from '../errors.js';
|
|
|
16
18
|
*/
|
|
17
19
|
const UPDATE_BASE = 'viable:manager-api:update:base';
|
|
18
20
|
const updateBase = openProtocol(route(UPDATE_BASE, '/update'));
|
|
21
|
+
/**
|
|
22
|
+
* The base alias and path manager-api mounts the planning protocol tree under.
|
|
23
|
+
*
|
|
24
|
+
* Literals for the same reason as {@link UPDATE_BASE}: they belong to manager-api, and
|
|
25
|
+
* `makePlanningProtocols` takes them as parameters so neither end imports the other's constants.
|
|
26
|
+
* Every planning alias and path derives from these, so the two ends agree on a route only while
|
|
27
|
+
* both build the tree from the same base, path and socket base.
|
|
28
|
+
*/
|
|
29
|
+
const PLANNING_BASE_ALIAS = 'viable:manager-api:planning';
|
|
30
|
+
const PLANNING_BASE_PATH = '/planning';
|
|
31
|
+
/**
|
|
32
|
+
* The planning tree exactly as manager-api mounts it, minus the ownership gate — a gate is the
|
|
33
|
+
* server's to apply, and a client binding carries none.
|
|
34
|
+
*/
|
|
35
|
+
const sdkPlanningProtocols = () => makePlanningProtocols({
|
|
36
|
+
base: { alias: PLANNING_BASE_ALIAS, path: PLANNING_BASE_PATH },
|
|
37
|
+
guards: DEFAULT_GUARD,
|
|
38
|
+
socketBase: updateBase,
|
|
39
|
+
});
|
|
19
40
|
/**
|
|
20
41
|
* A client context that speaks to a viable deployment with one access token.
|
|
21
42
|
*
|
|
@@ -74,14 +95,35 @@ export const makeSdkContext = async (opts) => {
|
|
|
74
95
|
guard: DEFAULT_GUARD,
|
|
75
96
|
updateBase,
|
|
76
97
|
});
|
|
77
|
-
// The
|
|
98
|
+
// The story tools speak planning: the same tree the platform mounts, reached with the same token.
|
|
99
|
+
// Its commit socket hangs under the platform's `/update` base as well, which is one more reason
|
|
100
|
+
// that base is declared here.
|
|
101
|
+
const planning = sdkPlanningProtocols();
|
|
102
|
+
// The socket routes hang under the platform's own websocket base, so that base has to exist
|
|
78
103
|
// here too — a parent a registry cannot resolve fails the whole context at init, not the one
|
|
79
104
|
// call that would have used it. It is a declaration-only namespace, so its client binding has
|
|
80
105
|
// no screen or request implementation.
|
|
81
|
-
const entrypoints = [
|
|
106
|
+
const entrypoints = [
|
|
107
|
+
bind(updateBase),
|
|
108
|
+
...protocols(surface).map(declaration => bind(declaration)),
|
|
109
|
+
...protocols(planning).map(declaration => bind(declaration)),
|
|
110
|
+
];
|
|
82
111
|
// Every caller gets a context-local client binding from the immutable protocol it shares with
|
|
83
112
|
// the server. No alias lookup can drift from a path or contract declaration.
|
|
84
113
|
context.registerEntrypoints(entrypoints);
|
|
114
|
+
appendPlanningClient(context, {
|
|
115
|
+
protocols: planning,
|
|
116
|
+
// Bound above, beside the connector routes, so one registration holds the whole surface.
|
|
117
|
+
bind: false,
|
|
118
|
+
// No socket opener: a commit is awaited by long poll only, which is the only transport the SDK
|
|
119
|
+
// speaks and the one that survives every proxy.
|
|
120
|
+
poll: COMMIT_POLL_SEC,
|
|
121
|
+
timeout: TOOL_DEADLINE_MS,
|
|
122
|
+
// Nothing a tool does reads a flow or a type, and the bundle would otherwise be fetched in the
|
|
123
|
+
// background the moment the context is ready — a network call from a server nobody has asked
|
|
124
|
+
// anything yet. `model()` still loads it on first use.
|
|
125
|
+
schemas: false,
|
|
126
|
+
});
|
|
85
127
|
await context.configure().init();
|
|
86
128
|
return context;
|
|
87
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{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AEF,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,CAAA;IAEhC,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -149,7 +149,7 @@ ${WORKER_BODY}
|
|
|
149
149
|
jsonKey: ['mcp', 'viable'],
|
|
150
150
|
content: JSON.stringify({
|
|
151
151
|
type: 'local',
|
|
152
|
-
command: ['npx', '-y', '@owlmeans/viable-mcp@^0.1.18-rc.
|
|
152
|
+
command: ['npx', '-y', '@owlmeans/viable-mcp@^0.1.18-rc.17'],
|
|
153
153
|
environment: { [ENV_TOKEN]: `{env:${ENV_TOKEN}}` },
|
|
154
154
|
enabled: true,
|
|
155
155
|
}, null, 2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../../src/tools/catalogue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../../src/tools/catalogue.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAY,cAAc,EAAE,QAAQ,EAAc,MAAM,YAAY,CAAA;AAChF,OAAO,EACkE,YAAY,EACpF,MAAM,YAAY,CAAA;AAyUnB;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,EAAE,cAAc,EAumCrC,CAAA;AAED,8CAA8C;AAC9C,eAAO,MAAM,YAAY,SAAU,QAAQ,KAAG,cAAc,EACT,CAAA;AAEnD,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,cAAc,GAAG,SACf,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
package/build/tools/catalogue.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CommitTimeout, TransitionAction, WorkcardKind } from '@owlmeans/planning';
|
|
3
|
+
import { ConnectJobKind, ConnectTarget, ConversionDecision, ConversionStatus, ConvertibilityVerdict, decisionFor, jobIdOf, MODEL_TIER_ROLES, OriginKind, STORY_BAND_MAX_USD, STORY_BAND_MIN_USD, VIABLE_STORY_TYPE, ViableStoryTransition } from '@owlmeans/viable-common';
|
|
4
|
+
import { COMMIT_WAIT_MS, JOB_POLL_MAX_SEC, NEXT_QUESTION_WAIT_MS, NEXT_TASK_WAIT_MS, STORY_PAGE_SIZE } from '../consts.js';
|
|
4
5
|
import { describeHarness, installHarness } from '../harness/index.js';
|
|
5
6
|
import { envStatus } from '../project/env.js';
|
|
6
7
|
import { missingServices, readSetupReport, renderSetupGuide, setUserEnv } from '../project/setup.js';
|
|
@@ -10,6 +11,7 @@ import { parseAnswer, renderQuestionEnvelope } from '../task/inquiry.js';
|
|
|
10
11
|
import { renderJob } from './jobs.js';
|
|
11
12
|
import { PLATFORM_CATALOGUE, renderPlatform } from './platform.js';
|
|
12
13
|
import { refusalMessage, refusalPhrase } from './refusal.js';
|
|
14
|
+
import { renderStories, resolveStory, STORY_ORDER, storyQuery } from './stories.js';
|
|
13
15
|
import { anyHost, cloudTarget, localTarget, performsModelTasks, sessionCapable, ToolHostKind, withExecutor } from './types.js';
|
|
14
16
|
const ok = (text, structured) => ({ text, structured });
|
|
15
17
|
const fail = (text) => ({ text, isError: true });
|
|
@@ -96,6 +98,9 @@ const ensureSession = async (deps, projectId) => {
|
|
|
96
98
|
* MCP tool at that boundary lets the parent's very next project operation lose a race it cannot
|
|
97
99
|
* observe. Wait for two stable unlocked observations so a just-dispatched cleanup also has time
|
|
98
100
|
* to acquire the lock before this tool declares the mutation settled.
|
|
101
|
+
*
|
|
102
|
+
* The delete's COMMIT is no substitute: it says the card is gone, and nothing about the
|
|
103
|
+
* placeholder screens the slot is still retiring under the project lock.
|
|
99
104
|
*/
|
|
100
105
|
const waitForStoryCleanup = async (deps, projectId) => {
|
|
101
106
|
const deadline = Date.now() + 5 * 60_000;
|
|
@@ -479,6 +484,7 @@ export const catalogue = [
|
|
|
479
484
|
description: z.string().optional(),
|
|
480
485
|
specification: z.string().optional(),
|
|
481
486
|
vision: z.string().optional(),
|
|
487
|
+
designSystem: z.string().optional(),
|
|
482
488
|
},
|
|
483
489
|
availability: anyHost,
|
|
484
490
|
run: async (args, deps) => {
|
|
@@ -493,6 +499,7 @@ export const catalogue = [
|
|
|
493
499
|
...(typeof args.description === 'string' ? { description: args.description } : {}),
|
|
494
500
|
...(typeof args.specification === 'string' ? { specification: args.specification } : {}),
|
|
495
501
|
...(typeof args.vision === 'string' ? { vision: args.vision } : {}),
|
|
502
|
+
...(typeof args.designSystem === 'string' ? { designSystem: args.designSystem } : {}),
|
|
496
503
|
});
|
|
497
504
|
return jobResult(job);
|
|
498
505
|
},
|
|
@@ -507,6 +514,12 @@ export const catalogue = [
|
|
|
507
514
|
const status = await deps.api.project.status(projectOf(args, deps));
|
|
508
515
|
const lines = [
|
|
509
516
|
`${status.project.name} (${status.project.alias}) · ${status.project.id}`,
|
|
517
|
+
// The project card's own status, from the project flow. Absent only from a platform that
|
|
518
|
+
// predates it, which says nothing rather than something false.
|
|
519
|
+
...(status.project.status != null
|
|
520
|
+
? [`project: ${status.project.status}`
|
|
521
|
+
+ `${status.project.intrinsic != null ? ` (${status.project.intrinsic})` : ''}`]
|
|
522
|
+
: []),
|
|
510
523
|
status.slot != null
|
|
511
524
|
? `slot: ${status.slot.kind} · ${status.slot.status}`
|
|
512
525
|
+ `${status.slot.initialized === true ? ' · initialized' : ' · not initialized'}`
|
|
@@ -525,6 +538,7 @@ export const catalogue = [
|
|
|
525
538
|
['description', status.project.description],
|
|
526
539
|
['specification', status.project.specification],
|
|
527
540
|
['vision', status.project.vision],
|
|
541
|
+
['design system', status.project.designSystem],
|
|
528
542
|
]) {
|
|
529
543
|
if (value != null && value.trim() !== '') {
|
|
530
544
|
lines.push('', `--- ${label} ---`, value.slice(0, DRAFT_CAP));
|
|
@@ -603,13 +617,17 @@ export const catalogue = [
|
|
|
603
617
|
},
|
|
604
618
|
availability: anyHost,
|
|
605
619
|
run: async (args, deps) => {
|
|
606
|
-
const
|
|
607
|
-
|
|
608
|
-
...(
|
|
609
|
-
|
|
610
|
-
|
|
620
|
+
const page = typeof args.page === 'number' ? args.page : 0;
|
|
621
|
+
const list = await deps.api.planning.cards.list({
|
|
622
|
+
...storyQuery(projectOf(args, deps), {
|
|
623
|
+
...(typeof args.status === 'string' ? { status: args.status } : {}),
|
|
624
|
+
...(typeof args.area === 'string' ? { area: args.area } : {}),
|
|
625
|
+
}),
|
|
626
|
+
page,
|
|
627
|
+
size: typeof args.size === 'number' ? args.size : STORY_PAGE_SIZE,
|
|
628
|
+
sort: STORY_ORDER,
|
|
611
629
|
});
|
|
612
|
-
return ok(renderStories(list.items, list.page, list.total), list);
|
|
630
|
+
return ok(renderStories(list.items, list.page ?? page, list.total), list);
|
|
613
631
|
},
|
|
614
632
|
},
|
|
615
633
|
{
|
|
@@ -620,8 +638,13 @@ export const catalogue = [
|
|
|
620
638
|
input: { q: z.string().min(1), projectId: z.string().optional() },
|
|
621
639
|
availability: anyHost,
|
|
622
640
|
run: async (args, deps) => {
|
|
623
|
-
const list = await deps.api.
|
|
624
|
-
|
|
641
|
+
const list = await deps.api.planning.cards.list({
|
|
642
|
+
...storyQuery(projectOf(args, deps), { q: args.q }),
|
|
643
|
+
page: 0,
|
|
644
|
+
size: STORY_PAGE_SIZE,
|
|
645
|
+
sort: STORY_ORDER,
|
|
646
|
+
});
|
|
647
|
+
return ok(renderStories(list.items, list.page ?? 0, list.total), list);
|
|
625
648
|
},
|
|
626
649
|
},
|
|
627
650
|
{
|
|
@@ -637,8 +660,22 @@ export const catalogue = [
|
|
|
637
660
|
// project therefore needs its connector back after an MCP restart even though this tool does
|
|
638
661
|
// not itself return a long-running job.
|
|
639
662
|
await ensureSession(deps, project);
|
|
640
|
-
|
|
641
|
-
|
|
663
|
+
// The narrative goes as written and with no area: rewriting it and deciding the area is the
|
|
664
|
+
// platform's, done on the way in for a person's story — a connector that guessed an area
|
|
665
|
+
// would be a second answer the platform then has to overrule.
|
|
666
|
+
const receipt = await deps.api.planning.execute({
|
|
667
|
+
action: TransitionAction.Create,
|
|
668
|
+
card: {
|
|
669
|
+
kind: WorkcardKind.Card,
|
|
670
|
+
type: VIABLE_STORY_TYPE,
|
|
671
|
+
parent: project,
|
|
672
|
+
title: args.story,
|
|
673
|
+
fields: { primary: false },
|
|
674
|
+
},
|
|
675
|
+
cause: 'connector:create-story',
|
|
676
|
+
}, { wait: true, timeout: COMMIT_WAIT_MS });
|
|
677
|
+
const card = receipt.card;
|
|
678
|
+
return ok(card?.code != null ? `Story ${card.code} created.` : 'Story created.', card ?? receipt.transition);
|
|
642
679
|
},
|
|
643
680
|
},
|
|
644
681
|
{
|
|
@@ -650,8 +687,18 @@ export const catalogue = [
|
|
|
650
687
|
run: async (args, deps) => {
|
|
651
688
|
const project = projectOf(args, deps);
|
|
652
689
|
await ensureSession(deps, project);
|
|
653
|
-
const
|
|
654
|
-
|
|
690
|
+
const card = await resolveStory(deps, project, args.storyId);
|
|
691
|
+
// Only the narrative: the status moves through the story flow and nowhere else, and the area
|
|
692
|
+
// follows the narrative on the platform's side. Guarded by the head the story was read at, so
|
|
693
|
+
// a change somebody else made in between is refused rather than overwritten.
|
|
694
|
+
const receipt = await deps.api.planning.execute({
|
|
695
|
+
card: card.id,
|
|
696
|
+
action: TransitionAction.Update,
|
|
697
|
+
changes: { title: args.story },
|
|
698
|
+
expectSeq: card.head ?? card.seq,
|
|
699
|
+
cause: 'connector:update-story',
|
|
700
|
+
}, { wait: true, timeout: COMMIT_WAIT_MS });
|
|
701
|
+
return ok('Story updated.', receipt.card ?? card);
|
|
655
702
|
},
|
|
656
703
|
},
|
|
657
704
|
{
|
|
@@ -665,7 +712,12 @@ export const catalogue = [
|
|
|
665
712
|
// Removing a story also retires its file-backed scaffold, so it has the same local-session
|
|
666
713
|
// requirement as formatting and development.
|
|
667
714
|
await ensureSession(deps, project);
|
|
668
|
-
await deps
|
|
715
|
+
const card = await resolveStory(deps, project, args.storyId);
|
|
716
|
+
await deps.api.planning.execute({
|
|
717
|
+
card: card.id,
|
|
718
|
+
action: TransitionAction.Delete,
|
|
719
|
+
cause: 'connector:delete-story',
|
|
720
|
+
}, { wait: true, timeout: COMMIT_WAIT_MS });
|
|
669
721
|
await waitForStoryCleanup(deps, project);
|
|
670
722
|
return ok('Story deleted.');
|
|
671
723
|
},
|
|
@@ -680,8 +732,27 @@ export const catalogue = [
|
|
|
680
732
|
run: async (args, deps) => {
|
|
681
733
|
const project = projectOf(args, deps);
|
|
682
734
|
await ensureSession(deps, project);
|
|
683
|
-
const
|
|
684
|
-
|
|
735
|
+
const card = await resolveStory(deps, project, args.storyId);
|
|
736
|
+
// Development is not a call of its own: it is the story's `start`, and the platform begins the
|
|
737
|
+
// run once that move has COMMITTED — which is also where it is refused (the wrong status,
|
|
738
|
+
// another story in progress, the balance).
|
|
739
|
+
try {
|
|
740
|
+
await deps.api.planning.execute({
|
|
741
|
+
card: card.id,
|
|
742
|
+
action: TransitionAction.Transit,
|
|
743
|
+
transition: ViableStoryTransition.Start,
|
|
744
|
+
cause: 'connector:develop-story',
|
|
745
|
+
}, { wait: true, timeout: COMMIT_WAIT_MS });
|
|
746
|
+
}
|
|
747
|
+
catch (e) {
|
|
748
|
+
if (!(e instanceof CommitTimeout))
|
|
749
|
+
throw e;
|
|
750
|
+
// The move is durable and only its commit is late, so the job row is still the answer —
|
|
751
|
+
// waiting out the host's ceiling here would report a slow platform as a broken server.
|
|
752
|
+
deps.log(`develop_story: the start of ${card.code ?? card.id} has not committed yet;`
|
|
753
|
+
+ ' answering from the job');
|
|
754
|
+
}
|
|
755
|
+
return jobResult(await deps.api.project.job(project, jobIdOf(ConnectJobKind.StoryDevelop, project, card.id)));
|
|
685
756
|
},
|
|
686
757
|
},
|
|
687
758
|
{
|
|
@@ -691,9 +762,11 @@ export const catalogue = [
|
|
|
691
762
|
input: { storyId: z.string(), projectId: z.string().optional() },
|
|
692
763
|
availability: anyHost,
|
|
693
764
|
run: async (args, deps) => {
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
|
|
765
|
+
const card = await resolveStory(deps, projectOf(args, deps), args.storyId);
|
|
766
|
+
// A warning is cleared by writing it empty, so an empty one is no warning at all.
|
|
767
|
+
const warning = card.fields?.warning;
|
|
768
|
+
return ok(`${card.code ?? card.id} · ${card.status}`
|
|
769
|
+
+ (warning != null && warning !== '' ? `\nwarning: ${String(warning)}` : ''), card);
|
|
697
770
|
},
|
|
698
771
|
},
|
|
699
772
|
{
|
|
@@ -1193,12 +1266,6 @@ export const catalogue = [
|
|
|
1193
1266
|
},
|
|
1194
1267
|
},
|
|
1195
1268
|
];
|
|
1196
|
-
const renderStories = (items, page, total) => items.length < 1
|
|
1197
|
-
? 'No stories.'
|
|
1198
|
-
: `${items.length} of ${total} (page ${page}):\n`
|
|
1199
|
-
+ items.map(item => ` ${String(item.code ?? item.id)} · ${String(item.status)}`
|
|
1200
|
-
+ `${item.primary === true ? ' · primary' : ''}`
|
|
1201
|
-
+ `${item.area != null ? ` · ${String(item.area)}` : ''}\n ${String(item.story).slice(0, 160)}`).join('\n');
|
|
1202
1269
|
/** The tools a given host actually offers. */
|
|
1203
1270
|
export const visibleTools = (host) => catalogue.filter(tool => tool.availability(host));
|
|
1204
1271
|
export const toolByName = (name) => catalogue.find(tool => tool.name === name);
|