@owlmeans/viable-sdk 0.1.18-rc.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.
- package/README.md +128 -0
- package/build/api/index.d.ts +2 -0
- package/build/api/index.d.ts.map +1 -0
- package/build/api/index.js +2 -0
- package/build/api/index.js.map +1 -0
- package/build/api/remote.d.ts +14 -0
- package/build/api/remote.d.ts.map +1 -0
- package/build/api/remote.js +123 -0
- package/build/api/remote.js.map +1 -0
- package/build/consts.d.ts +47 -0
- package/build/consts.d.ts.map +1 -0
- package/build/consts.js +47 -0
- package/build/consts.js.map +1 -0
- package/build/context/index.d.ts +22 -0
- package/build/context/index.d.ts.map +1 -0
- package/build/context/index.js +92 -0
- package/build/context/index.js.map +1 -0
- package/build/errors.d.ts +21 -0
- package/build/errors.d.ts.map +1 -0
- package/build/errors.js +36 -0
- package/build/errors.js.map +1 -0
- package/build/executor/boot-check.d.ts +73 -0
- package/build/executor/boot-check.d.ts.map +1 -0
- package/build/executor/boot-check.js +155 -0
- package/build/executor/boot-check.js.map +1 -0
- package/build/executor/env.d.ts +25 -0
- package/build/executor/env.d.ts.map +1 -0
- package/build/executor/env.js +77 -0
- package/build/executor/env.js.map +1 -0
- package/build/executor/errors.d.ts +69 -0
- package/build/executor/errors.d.ts.map +1 -0
- package/build/executor/errors.js +80 -0
- package/build/executor/errors.js.map +1 -0
- package/build/executor/files.d.ts +124 -0
- package/build/executor/files.d.ts.map +1 -0
- package/build/executor/files.js +529 -0
- package/build/executor/files.js.map +1 -0
- package/build/executor/git.d.ts +52 -0
- package/build/executor/git.d.ts.map +1 -0
- package/build/executor/git.js +353 -0
- package/build/executor/git.js.map +1 -0
- package/build/executor/health.d.ts +92 -0
- package/build/executor/health.d.ts.map +1 -0
- package/build/executor/health.js +98 -0
- package/build/executor/health.js.map +1 -0
- package/build/executor/index.d.ts +39 -0
- package/build/executor/index.d.ts.map +1 -0
- package/build/executor/index.js +173 -0
- package/build/executor/index.js.map +1 -0
- package/build/executor/integrity.d.ts +17 -0
- package/build/executor/integrity.d.ts.map +1 -0
- package/build/executor/integrity.js +59 -0
- package/build/executor/integrity.js.map +1 -0
- package/build/executor/layout.d.ts +61 -0
- package/build/executor/layout.d.ts.map +1 -0
- package/build/executor/layout.js +98 -0
- package/build/executor/layout.js.map +1 -0
- package/build/executor/shell.d.ts +89 -0
- package/build/executor/shell.d.ts.map +1 -0
- package/build/executor/shell.js +280 -0
- package/build/executor/shell.js.map +1 -0
- package/build/executor/spawn.d.ts +111 -0
- package/build/executor/spawn.d.ts.map +1 -0
- package/build/executor/spawn.js +314 -0
- package/build/executor/spawn.js.map +1 -0
- package/build/harness/index.d.ts +28 -0
- package/build/harness/index.d.ts.map +1 -0
- package/build/harness/index.js +83 -0
- package/build/harness/index.js.map +1 -0
- package/build/harness/templates.d.ts +30 -0
- package/build/harness/templates.d.ts.map +1 -0
- package/build/harness/templates.js +162 -0
- package/build/harness/templates.js.map +1 -0
- package/build/index.d.ts +13 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +12 -0
- package/build/index.js.map +1 -0
- package/build/project/env.d.ts +108 -0
- package/build/project/env.d.ts.map +1 -0
- package/build/project/env.js +233 -0
- package/build/project/env.js.map +1 -0
- package/build/project/marker.d.ts +34 -0
- package/build/project/marker.d.ts.map +1 -0
- package/build/project/marker.js +54 -0
- package/build/project/marker.js.map +1 -0
- package/build/project/setup.d.ts +62 -0
- package/build/project/setup.d.ts.map +1 -0
- package/build/project/setup.js +190 -0
- package/build/project/setup.js.map +1 -0
- package/build/run/index.d.ts +75 -0
- package/build/run/index.d.ts.map +1 -0
- package/build/run/index.js +150 -0
- package/build/run/index.js.map +1 -0
- package/build/run/serve.d.ts +18 -0
- package/build/run/serve.d.ts.map +1 -0
- package/build/run/serve.js +148 -0
- package/build/run/serve.js.map +1 -0
- package/build/run/state.d.ts +75 -0
- package/build/run/state.d.ts.map +1 -0
- package/build/run/state.js +136 -0
- package/build/run/state.js.map +1 -0
- package/build/session/index.d.ts +17 -0
- package/build/session/index.d.ts.map +1 -0
- package/build/session/index.js +226 -0
- package/build/session/index.js.map +1 -0
- package/build/session/questions.d.ts +16 -0
- package/build/session/questions.d.ts.map +1 -0
- package/build/session/questions.js +17 -0
- package/build/session/questions.js.map +1 -0
- package/build/session/queue.d.ts +54 -0
- package/build/session/queue.d.ts.map +1 -0
- package/build/session/queue.js +102 -0
- package/build/session/queue.js.map +1 -0
- package/build/session/tasks.d.ts +15 -0
- package/build/session/tasks.d.ts.map +1 -0
- package/build/session/tasks.js +16 -0
- package/build/session/tasks.js.map +1 -0
- package/build/task/driver.d.ts +30 -0
- package/build/task/driver.d.ts.map +1 -0
- package/build/task/driver.js +120 -0
- package/build/task/driver.js.map +1 -0
- package/build/task/envelope.d.ts +35 -0
- package/build/task/envelope.d.ts.map +1 -0
- package/build/task/envelope.js +230 -0
- package/build/task/envelope.js.map +1 -0
- package/build/task/index.d.ts +4 -0
- package/build/task/index.d.ts.map +1 -0
- package/build/task/index.js +4 -0
- package/build/task/index.js.map +1 -0
- package/build/task/inquiry.d.ts +53 -0
- package/build/task/inquiry.d.ts.map +1 -0
- package/build/task/inquiry.js +232 -0
- package/build/task/inquiry.js.map +1 -0
- package/build/tools/catalogue.d.ts +17 -0
- package/build/tools/catalogue.d.ts.map +1 -0
- package/build/tools/catalogue.js +1169 -0
- package/build/tools/catalogue.js.map +1 -0
- package/build/tools/index.d.ts +7 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +7 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/jobs.d.ts +12 -0
- package/build/tools/jobs.d.ts.map +1 -0
- package/build/tools/jobs.js +60 -0
- package/build/tools/jobs.js.map +1 -0
- package/build/tools/mcp.d.ts +43 -0
- package/build/tools/mcp.d.ts.map +1 -0
- package/build/tools/mcp.js +131 -0
- package/build/tools/mcp.js.map +1 -0
- package/build/tools/platform.d.ts +77 -0
- package/build/tools/platform.d.ts.map +1 -0
- package/build/tools/platform.js +316 -0
- package/build/tools/platform.js.map +1 -0
- package/build/tools/refusal.d.ts +66 -0
- package/build/tools/refusal.d.ts.map +1 -0
- package/build/tools/refusal.js +377 -0
- package/build/tools/refusal.js.map +1 -0
- package/build/tools/types.d.ts +83 -0
- package/build/tools/types.d.ts.map +1 -0
- package/build/tools/types.js +38 -0
- package/build/tools/types.js.map +1 -0
- package/build/types.d.ts +174 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/package.json +105 -0
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# @owlmeans/viable-sdk
|
|
2
|
+
|
|
3
|
+
Drive the OwlMeans Viable platform from outside it.
|
|
4
|
+
|
|
5
|
+
Viable turns a description into a running full-stack application. This package is what lets
|
|
6
|
+
something that is not the Viable manager do that: a coding agent through
|
|
7
|
+
[`@owlmeans/viable-mcp`](../viable-mcp), a CLI, a test. It owns the four things such a client
|
|
8
|
+
needs and the platform cannot supply:
|
|
9
|
+
|
|
10
|
+
- **a client context** that authenticates with one long-lived access token and nothing else;
|
|
11
|
+
- **a connector API** — one interface, two implementations, so a tool written against it works
|
|
12
|
+
both over HTTP and in-process;
|
|
13
|
+
- **a session runtime** that answers the operations the platform sends: file writes, shell
|
|
14
|
+
commands and git against a project on the user's own machine;
|
|
15
|
+
- **the tool catalogue and the model-task protocol** a parent agent reads — including the
|
|
16
|
+
questions the platform puts to a person, and the tools for converting an application that
|
|
17
|
+
already exists.
|
|
18
|
+
|
|
19
|
+
## The two axes
|
|
20
|
+
|
|
21
|
+
A session has a **target** and an **llm**, and they are independent.
|
|
22
|
+
|
|
23
|
+
| | `cloud` | `local` |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| **target** | the project lives in a Viable preview slot | the project lives in a directory here, and this package executes every command against it |
|
|
26
|
+
| **llm** | Viable performs the model calls | the parent agent performs them, one at a time, in a clean subagent |
|
|
27
|
+
|
|
28
|
+
## Using it
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import {
|
|
32
|
+
makeSdkContext, makeRemoteConnectorApi, openSession
|
|
33
|
+
} from '@owlmeans/viable-sdk'
|
|
34
|
+
import { makeLocalSlotExecutor } from '@owlmeans/viable-sdk/executor'
|
|
35
|
+
import { ConnectHarness, ConnectLlm, ConnectTarget } from '@owlmeans/viable-common'
|
|
36
|
+
|
|
37
|
+
const context = await makeSdkContext({ apiUrl, token })
|
|
38
|
+
const api = makeRemoteConnectorApi(context)
|
|
39
|
+
|
|
40
|
+
const session = await openSession({
|
|
41
|
+
api,
|
|
42
|
+
executor: makeLocalSlotExecutor(projectDir),
|
|
43
|
+
open: {
|
|
44
|
+
projectDir,
|
|
45
|
+
target: ConnectTarget.Local,
|
|
46
|
+
llm: ConnectLlm.Cloud,
|
|
47
|
+
harness: ConnectHarness.Other,
|
|
48
|
+
clientVersion: '1.0.0',
|
|
49
|
+
capabilities: { harness: ConnectHarness.Other, tiers: {}, subagents: false, effortControl: false, executors: [] },
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const job = await api.project.create('a tool for tracking gym workouts', ConnectTarget.Local)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The session runs its own loop from that point: operations arrive, the executor answers them, model
|
|
57
|
+
tasks queue for the parent agent.
|
|
58
|
+
|
|
59
|
+
## Rules worth knowing before you change something
|
|
60
|
+
|
|
61
|
+
**Every tool answers within 45 seconds.** The strictest MCP host in the field bounds a tool call at
|
|
62
|
+
sixty. Anything that takes minutes is a JOB: it returns at once and is polled. A tool that blocked
|
|
63
|
+
would be reported to the user as a hung server rather than as a slow platform.
|
|
64
|
+
|
|
65
|
+
**A tool that cannot work in a mode is hidden, not failing.** `visibleTools(host)` is the whole
|
|
66
|
+
catalogue a parent sees, and it is exactly the set of things that work for it. A tool offered and
|
|
67
|
+
then refused is one an agent tries once and remembers as broken.
|
|
68
|
+
|
|
69
|
+
**The session loop is serial.** The thing on the other end of a local operation is a filesystem the
|
|
70
|
+
platform believes it is the only writer of. Two concurrent template writes into one tree is not a
|
|
71
|
+
throughput problem, it is a corrupted tree.
|
|
72
|
+
|
|
73
|
+
**Results are cached by operation id.** A connector that reconnects is handed everything still
|
|
74
|
+
outstanding, including what it had already answered when the connection dropped. Re-running a build
|
|
75
|
+
because an acknowledgement was lost is exactly the cost that cache avoids.
|
|
76
|
+
|
|
77
|
+
**A question is the user's, and the connector answers none of it.** An inquiry arrives on the
|
|
78
|
+
same operation loop as everything else and is executed by nobody: `next_question` hands it to the
|
|
79
|
+
parent to put to a person, and `answer_question` sends the answer back. The two queues stay
|
|
80
|
+
separate from the task queue, because draining one list would sooner or later hand a decision
|
|
81
|
+
about somebody's project to a subagent. Declining is an answer — a parent whose user is away says
|
|
82
|
+
so rather than waiting out the deadline or inventing one.
|
|
83
|
+
|
|
84
|
+
**A model task is handed over once.** The platform redelivers every unanswered operation on each
|
|
85
|
+
poll, which is free for a slot command the result cache answers and expensive for a task a
|
|
86
|
+
subagent is already working on. The shared queue remembers every id it has handed over and ignores
|
|
87
|
+
a second delivery of one, while still refreshing the operation the answer must route to.
|
|
88
|
+
|
|
89
|
+
**A malformed model-task answer is refused locally.** `parseTaskResult` checks the answer against
|
|
90
|
+
the task before the platform ever sees it — with the subagent's context still open, so the parent
|
|
91
|
+
can retry immediately. A malformed answer that reached the platform would cost a whole new task, a
|
|
92
|
+
new subagent and another wait.
|
|
93
|
+
|
|
94
|
+
**A refusal is phrased from its marker.** The platform's refusal classes live in packages this one
|
|
95
|
+
does not depend on, so an error crossing the wire arrives as a marshalled `type|||marker|||stack`
|
|
96
|
+
wrapped in a local stack trace. `REFUSALS` maps the marker to one sentence a parent agent can act
|
|
97
|
+
on; an unknown marker keeps the marker and names the tool to call next, and no stack ever reaches
|
|
98
|
+
the model — including the one shape with no separator in it, where `ResilientError.ensure` swaps a
|
|
99
|
+
plain-text response body into `type` and its stack into `message`.
|
|
100
|
+
|
|
101
|
+
**A refusal reads the same wherever it is rendered.** The same marker arrives thrown from a call
|
|
102
|
+
and stored as text — `job.error`, `slot.lastError`, a conversion's `lastError`, a pipeline row's
|
|
103
|
+
`error` — so every one of those goes through `refusalPhrase` too. Anything that is not a refusal,
|
|
104
|
+
a build warning above all, is rendered exactly as it stands.
|
|
105
|
+
|
|
106
|
+
**The harness installer never writes the token.** Each configuration references the environment
|
|
107
|
+
variable in its own syntax, so what it writes is safe to commit. `tests/harness.spec.ts` greps
|
|
108
|
+
every written file for a token shape.
|
|
109
|
+
|
|
110
|
+
## Tests
|
|
111
|
+
|
|
112
|
+
`bun test ./tests` — all offline.
|
|
113
|
+
|
|
114
|
+
<!-- owlmeans:agent-guidance:start -->
|
|
115
|
+
## Agent guidance
|
|
116
|
+
|
|
117
|
+
This package ships embedded agent skills under `agent-meta/`. After installing your
|
|
118
|
+
`@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
|
|
119
|
+
your project's skill store (`.agents/skills/`):
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.13
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The embedded files are version-matched to this package release. Do not edit them
|
|
126
|
+
directly — they are regenerated on each publish. To contribute guidance edits,
|
|
127
|
+
open a PR against the source monorepo.
|
|
128
|
+
<!-- owlmeans:agent-guidance:end -->
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ClientConfig, ClientContext } from '@owlmeans/client-context';
|
|
2
|
+
import type { ConnectorApi } from '../types.js';
|
|
3
|
+
type Ctx = ClientContext<ClientConfig>;
|
|
4
|
+
/**
|
|
5
|
+
* The connector API over HTTP.
|
|
6
|
+
*
|
|
7
|
+
* Every call is bounded by the tool deadline rather than left to the transport's own default: a
|
|
8
|
+
* tool that outlives its host's ceiling is reported to the user as a broken server, and the true
|
|
9
|
+
* answer — the platform was slow — never reaches them. Anything that legitimately takes longer is
|
|
10
|
+
* a job, and a job returns at once.
|
|
11
|
+
*/
|
|
12
|
+
export declare const makeRemoteConnectorApi: (context: Ctx) => ConnectorApi;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +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,EAA6C,MAAM,aAAa,CAAA;AAE1F,KAAK,GAAG,GAAG,aAAa,CAAC,YAAY,CAAC,CAAA;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,YAAa,GAAG,KAAG,YAoIrD,CAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { connectRef } from '@owlmeans/viable-common';
|
|
2
|
+
import { TOOL_DEADLINE_MS } from '../consts.js';
|
|
3
|
+
/**
|
|
4
|
+
* The connector API over HTTP.
|
|
5
|
+
*
|
|
6
|
+
* Every call is bounded by the tool deadline rather than left to the transport's own default: a
|
|
7
|
+
* tool that outlives its host's ceiling is reported to the user as a broken server, and the true
|
|
8
|
+
* answer — the platform was slow — never reaches them. Anything that legitimately takes longer is
|
|
9
|
+
* a job, and a job returns at once.
|
|
10
|
+
*/
|
|
11
|
+
export const makeRemoteConnectorApi = (context) => {
|
|
12
|
+
return {
|
|
13
|
+
capabilities: async () => await context
|
|
14
|
+
.entrypoint(connectRef.capabilities).call({ timeout: TOOL_DEADLINE_MS }),
|
|
15
|
+
openSession: async (args) => {
|
|
16
|
+
const { llm, ...body } = args;
|
|
17
|
+
// Which route is called fixes the mode: the delegated one carries the entitlement gate.
|
|
18
|
+
return await context.entrypoint(llm === 'local'
|
|
19
|
+
? connectRef.session.openDelegated : connectRef.session.open).call({ body, timeout: TOOL_DEADLINE_MS });
|
|
20
|
+
},
|
|
21
|
+
closeSession: async (sessionId) => {
|
|
22
|
+
await context.entrypoint(connectRef.session.close).call({
|
|
23
|
+
params: { sessionId }, timeout: TOOL_DEADLINE_MS,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
heartbeat: async (sessionId) => await context.entrypoint(connectRef.session.heartbeat).call({
|
|
27
|
+
params: { sessionId }, timeout: TOOL_DEADLINE_MS,
|
|
28
|
+
}),
|
|
29
|
+
pullOps: async (sessionId, waitSec) => await context.entrypoint(connectRef.op.pull).call({
|
|
30
|
+
params: { sessionId },
|
|
31
|
+
query: { wait: waitSec },
|
|
32
|
+
// The long poll holds the response open on purpose; it must outlast its own wait.
|
|
33
|
+
timeout: (waitSec + 10) * 1000,
|
|
34
|
+
}),
|
|
35
|
+
submitOp: async (sessionId, result) => await context
|
|
36
|
+
.entrypoint(connectRef.op.submit).call({
|
|
37
|
+
params: { sessionId, opId: result.opId }, body: result,
|
|
38
|
+
timeout: TOOL_DEADLINE_MS,
|
|
39
|
+
}),
|
|
40
|
+
project: {
|
|
41
|
+
create: async (prompt, target) => await context.entrypoint(connectRef.project.create).call({
|
|
42
|
+
body: { prompt, ...(target != null ? { target } : {}) }, timeout: TOOL_DEADLINE_MS,
|
|
43
|
+
}),
|
|
44
|
+
confirm: async (id, edits) => await context.entrypoint(connectRef.project.confirm).call({
|
|
45
|
+
params: { id }, body: edits, timeout: TOOL_DEADLINE_MS,
|
|
46
|
+
}),
|
|
47
|
+
list: async () => await context.entrypoint(connectRef.project.list).call({ timeout: TOOL_DEADLINE_MS }),
|
|
48
|
+
status: async (id) => await context
|
|
49
|
+
.entrypoint(connectRef.project.status).call({ params: { id }, timeout: TOOL_DEADLINE_MS }),
|
|
50
|
+
attach: async (args) => await context.entrypoint(connectRef.project.attach).call({
|
|
51
|
+
body: args, timeout: TOOL_DEADLINE_MS,
|
|
52
|
+
}),
|
|
53
|
+
reinit: async (id) => await context
|
|
54
|
+
.entrypoint(connectRef.project.reinit).call({ params: { id }, timeout: TOOL_DEADLINE_MS }),
|
|
55
|
+
modify: async (id, prompt) => await context.entrypoint(connectRef.project.modify).call({
|
|
56
|
+
params: { id }, body: { prompt }, timeout: TOOL_DEADLINE_MS,
|
|
57
|
+
}),
|
|
58
|
+
job: async (id, jobId, waitSec) => await context
|
|
59
|
+
.entrypoint(connectRef.project.job).call({
|
|
60
|
+
params: { id, jobId },
|
|
61
|
+
query: waitSec == null ? {} : { wait: waitSec },
|
|
62
|
+
timeout: waitSec == null ? TOOL_DEADLINE_MS : (waitSec + 10) * 1000,
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
story: {
|
|
66
|
+
list: async (id, query) => await context.entrypoint(connectRef.story.list).call({
|
|
67
|
+
params: { id }, query: query ?? {}, timeout: TOOL_DEADLINE_MS,
|
|
68
|
+
}),
|
|
69
|
+
get: async (id, storyId) => await context
|
|
70
|
+
.entrypoint(connectRef.story.get).call({ params: { id, storyId }, timeout: TOOL_DEADLINE_MS }),
|
|
71
|
+
create: async (id, story) => await context
|
|
72
|
+
.entrypoint(connectRef.story.create).call({ params: { id }, body: { story }, timeout: TOOL_DEADLINE_MS }),
|
|
73
|
+
update: async (id, storyId, story) => await context.entrypoint(connectRef.story.update).call({
|
|
74
|
+
params: { id, storyId }, body: { story }, timeout: TOOL_DEADLINE_MS,
|
|
75
|
+
}),
|
|
76
|
+
remove: async (id, storyId) => await context
|
|
77
|
+
.entrypoint(connectRef.story.delete).call({ params: { id, storyId }, timeout: TOOL_DEADLINE_MS }),
|
|
78
|
+
develop: async (id, storyId) => await context.entrypoint(connectRef.story.develop).call({
|
|
79
|
+
params: { id, storyId }, timeout: TOOL_DEADLINE_MS,
|
|
80
|
+
}),
|
|
81
|
+
},
|
|
82
|
+
files: {
|
|
83
|
+
list: async (id) => await context.entrypoint(connectRef.files.list).call({
|
|
84
|
+
params: { id }, timeout: TOOL_DEADLINE_MS,
|
|
85
|
+
}),
|
|
86
|
+
},
|
|
87
|
+
pipeline: {
|
|
88
|
+
state: async (id, runId) => await context
|
|
89
|
+
.entrypoint(connectRef.pipeline.state).call({ params: { id, runId }, timeout: TOOL_DEADLINE_MS }),
|
|
90
|
+
resume: async (id, runId, args) => await context.entrypoint(connectRef.pipeline.resume).call({
|
|
91
|
+
params: { id, runId }, body: args ?? {}, timeout: TOOL_DEADLINE_MS,
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
convert: {
|
|
95
|
+
create: async (args) => await context.entrypoint(connectRef.convert.create).call({
|
|
96
|
+
body: args, timeout: TOOL_DEADLINE_MS,
|
|
97
|
+
}),
|
|
98
|
+
check: async (id) => await context
|
|
99
|
+
.entrypoint(connectRef.convert.check).call({ params: { id }, timeout: TOOL_DEADLINE_MS }),
|
|
100
|
+
start: async (id) => await context
|
|
101
|
+
.entrypoint(connectRef.convert.start).call({ params: { id }, timeout: TOOL_DEADLINE_MS }),
|
|
102
|
+
proceed: async (id, decision, note) => await context.entrypoint(connectRef.convert.proceed).call({
|
|
103
|
+
params: { id }, body: { decision, ...(note != null ? { note } : {}) },
|
|
104
|
+
timeout: TOOL_DEADLINE_MS,
|
|
105
|
+
}),
|
|
106
|
+
cancel: async (id) => await context
|
|
107
|
+
.entrypoint(connectRef.convert.cancel).call({ params: { id }, timeout: TOOL_DEADLINE_MS }),
|
|
108
|
+
status: async (id) => await context
|
|
109
|
+
.entrypoint(connectRef.convert.status).call({ params: { id }, timeout: TOOL_DEADLINE_MS }),
|
|
110
|
+
purge: async (id) => await context
|
|
111
|
+
.entrypoint(connectRef.convert.purge).call({ params: { id }, timeout: TOOL_DEADLINE_MS }),
|
|
112
|
+
},
|
|
113
|
+
inquiry: {
|
|
114
|
+
answer: async (id, inquiryId, answer) =>
|
|
115
|
+
// The id travels twice on purpose: in the path, which is what the route addresses, and in
|
|
116
|
+
// the body, which is what the platform validates the answer against.
|
|
117
|
+
await context.entrypoint(connectRef.inquiry.answer).call({
|
|
118
|
+
params: { id, inquiryId }, body: { ...answer, inquiryId }, timeout: TOOL_DEADLINE_MS,
|
|
119
|
+
}),
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/api/remote.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAOpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAK/C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAY,EAAgB,EAAE;IACnE,OAAO;QACL,YAAY,EAAE,KAAK,IAAsC,EAAE,CAAC,MAAM,OAAO;aACtE,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;QAE1E,WAAW,EAAE,KAAK,EAAE,IAAqB,EAA+B,EAAE;YACxE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;YAC7B,wFAAwF;YACxF,OAAO,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,KAAK,OAAO;gBAC7C,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAC7D,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAA;QAC7C,CAAC;QAED,YAAY,EAAE,KAAK,EAAC,SAAS,EAAC,EAAE;YAC9B,MAAM,OAAO,CAAC,UAAU,CAAC,UAAU,C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,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,gBAAgB;aACrF,CAAC;SACL;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Where the connector reads its configuration from. Only the token is a secret. */
|
|
2
|
+
export declare const ENV_TOKEN = "VIABLE_API_TOKEN";
|
|
3
|
+
export declare const ENV_API_URL = "VIABLE_API_URL";
|
|
4
|
+
export declare const ENV_TARGET = "VIABLE_TARGET";
|
|
5
|
+
export declare const ENV_LLM = "VIABLE_LLM";
|
|
6
|
+
export declare const ENV_HARNESS = "VIABLE_HARNESS";
|
|
7
|
+
export declare const ENV_PROJECT_DIR = "VIABLE_PROJECT_DIR";
|
|
8
|
+
/** The service alias the SDK's own client context registers under. */
|
|
9
|
+
export declare const SDK_SERVICE = "viable-sdk";
|
|
10
|
+
/**
|
|
11
|
+
* The longest any tool may take to answer.
|
|
12
|
+
*
|
|
13
|
+
* Every MCP host bounds a tool call, and the strictest default in the field is sixty seconds
|
|
14
|
+
* (Codex). Forty-five leaves room for the round trip and keeps the connector inside every host's
|
|
15
|
+
* ceiling without configuration — which is why long operations are JOBS that return at once and
|
|
16
|
+
* are polled, rather than calls that block.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TOOL_DEADLINE_MS = 45000;
|
|
19
|
+
/**
|
|
20
|
+
* The longest a job poll may hold its answer, in seconds.
|
|
21
|
+
*
|
|
22
|
+
* Strictly under {@link TOOL_DEADLINE_MS}, with room for the round trip. Set equal to it, a poll
|
|
23
|
+
* that used its whole window lost the race with its own deadline every time — and the tool's own
|
|
24
|
+
* "call this next" line suggested exactly that value, so an agent following the instructions it
|
|
25
|
+
* was given failed on every poll that ran the full window.
|
|
26
|
+
*/
|
|
27
|
+
export declare const JOB_POLL_MAX_SEC = 30;
|
|
28
|
+
/** How long `next_task` waits before answering "nothing yet". Under every host's ceiling. */
|
|
29
|
+
export declare const NEXT_TASK_WAIT_MS = 30000;
|
|
30
|
+
/**
|
|
31
|
+
* How long `next_question` waits before answering "nothing yet".
|
|
32
|
+
*
|
|
33
|
+
* The same window as a model task's, and for the host's reasons rather than the person's: nobody
|
|
34
|
+
* is expected to answer inside it. What the wait buys is a parent that asked one call too early —
|
|
35
|
+
* the platform queues the question a moment after the job reported it — and what the ceiling buys
|
|
36
|
+
* is that the call returns before the host's own deadline turns it into a broken server.
|
|
37
|
+
*/
|
|
38
|
+
export declare const NEXT_QUESTION_WAIT_MS = 30000;
|
|
39
|
+
/** How long a pull waits for an operation before answering empty. */
|
|
40
|
+
export declare const PULL_WAIT_MS = 30000;
|
|
41
|
+
/** How often a socket says it is still there. Presence outlives three missed pings. */
|
|
42
|
+
export declare const PING_INTERVAL_MS = 30000;
|
|
43
|
+
/** How long the socket handshake may take before the connector falls back to polling. */
|
|
44
|
+
export declare const SOCKET_HANDSHAKE_MS = 10000;
|
|
45
|
+
/** Reconnection backoff, in order. The last entry repeats. */
|
|
46
|
+
export declare const RECONNECT_BACKOFF_MS: number[];
|
|
47
|
+
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,eAAO,MAAM,SAAS,qBAAqB,CAAA;AAC3C,eAAO,MAAM,WAAW,mBAAmB,CAAA;AAC3C,eAAO,MAAM,UAAU,kBAAkB,CAAA;AACzC,eAAO,MAAM,OAAO,eAAe,CAAA;AACnC,eAAO,MAAM,WAAW,mBAAmB,CAAA;AAC3C,eAAO,MAAM,eAAe,uBAAuB,CAAA;AAEnD,sEAAsE;AACtE,eAAO,MAAM,WAAW,eAAe,CAAA;AAEvC;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,QAAS,CAAA;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAElC,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
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Where the connector reads its configuration from. Only the token is a secret. */
|
|
2
|
+
export const ENV_TOKEN = 'VIABLE_API_TOKEN';
|
|
3
|
+
export const ENV_API_URL = 'VIABLE_API_URL';
|
|
4
|
+
export const ENV_TARGET = 'VIABLE_TARGET';
|
|
5
|
+
export const ENV_LLM = 'VIABLE_LLM';
|
|
6
|
+
export const ENV_HARNESS = 'VIABLE_HARNESS';
|
|
7
|
+
export const ENV_PROJECT_DIR = 'VIABLE_PROJECT_DIR';
|
|
8
|
+
/** The service alias the SDK's own client context registers under. */
|
|
9
|
+
export const SDK_SERVICE = 'viable-sdk';
|
|
10
|
+
/**
|
|
11
|
+
* The longest any tool may take to answer.
|
|
12
|
+
*
|
|
13
|
+
* Every MCP host bounds a tool call, and the strictest default in the field is sixty seconds
|
|
14
|
+
* (Codex). Forty-five leaves room for the round trip and keeps the connector inside every host's
|
|
15
|
+
* ceiling without configuration — which is why long operations are JOBS that return at once and
|
|
16
|
+
* are polled, rather than calls that block.
|
|
17
|
+
*/
|
|
18
|
+
export const TOOL_DEADLINE_MS = 45_000;
|
|
19
|
+
/**
|
|
20
|
+
* The longest a job poll may hold its answer, in seconds.
|
|
21
|
+
*
|
|
22
|
+
* Strictly under {@link TOOL_DEADLINE_MS}, with room for the round trip. Set equal to it, a poll
|
|
23
|
+
* that used its whole window lost the race with its own deadline every time — and the tool's own
|
|
24
|
+
* "call this next" line suggested exactly that value, so an agent following the instructions it
|
|
25
|
+
* was given failed on every poll that ran the full window.
|
|
26
|
+
*/
|
|
27
|
+
export const JOB_POLL_MAX_SEC = 30;
|
|
28
|
+
/** How long `next_task` waits before answering "nothing yet". Under every host's ceiling. */
|
|
29
|
+
export const NEXT_TASK_WAIT_MS = 30_000;
|
|
30
|
+
/**
|
|
31
|
+
* How long `next_question` waits before answering "nothing yet".
|
|
32
|
+
*
|
|
33
|
+
* The same window as a model task's, and for the host's reasons rather than the person's: nobody
|
|
34
|
+
* is expected to answer inside it. What the wait buys is a parent that asked one call too early —
|
|
35
|
+
* the platform queues the question a moment after the job reported it — and what the ceiling buys
|
|
36
|
+
* is that the call returns before the host's own deadline turns it into a broken server.
|
|
37
|
+
*/
|
|
38
|
+
export const NEXT_QUESTION_WAIT_MS = 30_000;
|
|
39
|
+
/** How long a pull waits for an operation before answering empty. */
|
|
40
|
+
export const PULL_WAIT_MS = 30_000;
|
|
41
|
+
/** How often a socket says it is still there. Presence outlives three missed pings. */
|
|
42
|
+
export const PING_INTERVAL_MS = 30_000;
|
|
43
|
+
/** How long the socket handshake may take before the connector falls back to polling. */
|
|
44
|
+
export const SOCKET_HANDSHAKE_MS = 10_000;
|
|
45
|
+
/** Reconnection backoff, in order. The last entry repeats. */
|
|
46
|
+
export const RECONNECT_BACKOFF_MS = [1_000, 2_000, 5_000, 10_000, 30_000];
|
|
47
|
+
//# sourceMappingURL=consts.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ClientConfig, ClientContext } from '@owlmeans/client-context';
|
|
2
|
+
import { connect } from '@owlmeans/viable-common';
|
|
3
|
+
export interface SdkContextOptions {
|
|
4
|
+
apiUrl: string;
|
|
5
|
+
token: string;
|
|
6
|
+
/** The service alias the API is registered under. One deployment, one alias. */
|
|
7
|
+
service?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A client context that speaks to a viable deployment with one access token.
|
|
11
|
+
*
|
|
12
|
+
* The same machinery a browser uses — the API client, the entrypoint registry, the auth
|
|
13
|
+
* middleware — with one difference: the guard holds a long-lived credential the user was handed
|
|
14
|
+
* instead of a session it negotiated. Registering it under the alias the routes already name is
|
|
15
|
+
* what makes every unchanged route declaration work from a process that has no browser.
|
|
16
|
+
*
|
|
17
|
+
* There is deliberately no second credential path. A connector that could fall back to some other
|
|
18
|
+
* form of authentication would be a connector whose access nobody can revoke by revoking a token.
|
|
19
|
+
*/
|
|
20
|
+
export declare const makeSdkContext: (opts: SdkContextOptions) => Promise<ClientContext<ClientConfig>>;
|
|
21
|
+
export { connect };
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AAM3E,OAAO,EAAE,OAAO,EAA4C,MAAM,yBAAyB,CAAA;AAY3F,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,CAsEjG,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { AppType } from '@owlmeans/context';
|
|
2
|
+
import { makeClientContext } from '@owlmeans/client-context';
|
|
3
|
+
import { elevate } from '@owlmeans/client-entrypoint';
|
|
4
|
+
import { entrypoint } from '@owlmeans/entrypoint';
|
|
5
|
+
import { route } from '@owlmeans/route';
|
|
6
|
+
import { authMiddleware, DEFAULT_GUARD } from '@owlmeans/auth-common';
|
|
7
|
+
import { makeTokenCarrierGuard } from '@owlmeans/auth-token';
|
|
8
|
+
import { connect, connectEntrypoints, CONNECT_TOKEN_PREFIX } from '@owlmeans/viable-common';
|
|
9
|
+
import { SDK_SERVICE } from '../consts.js';
|
|
10
|
+
import { SdkAuthError, SdkMisconfigured } from '../errors.js';
|
|
11
|
+
/**
|
|
12
|
+
* The platform's websocket namespace, which the connector's socket route is declared under.
|
|
13
|
+
*
|
|
14
|
+
* A literal because it belongs to manager-api: the contract package takes it as a parameter for
|
|
15
|
+
* exactly this reason, so that neither end has to import the other's constants.
|
|
16
|
+
*/
|
|
17
|
+
const UPDATE_BASE = 'viable:manager-api:update:base';
|
|
18
|
+
/**
|
|
19
|
+
* A client context that speaks to a viable deployment with one access token.
|
|
20
|
+
*
|
|
21
|
+
* The same machinery a browser uses — the API client, the entrypoint registry, the auth
|
|
22
|
+
* middleware — with one difference: the guard holds a long-lived credential the user was handed
|
|
23
|
+
* instead of a session it negotiated. Registering it under the alias the routes already name is
|
|
24
|
+
* what makes every unchanged route declaration work from a process that has no browser.
|
|
25
|
+
*
|
|
26
|
+
* There is deliberately no second credential path. A connector that could fall back to some other
|
|
27
|
+
* form of authentication would be a connector whose access nobody can revoke by revoking a token.
|
|
28
|
+
*/
|
|
29
|
+
export const makeSdkContext = async (opts) => {
|
|
30
|
+
if (opts.token === '') {
|
|
31
|
+
throw new SdkMisconfigured('token');
|
|
32
|
+
}
|
|
33
|
+
if (!opts.token.startsWith(CONNECT_TOKEN_PREFIX)) {
|
|
34
|
+
// Refused here rather than at the first call: a value that is not one of this platform's
|
|
35
|
+
// tokens produces a 401 with nothing in it about which of the several plausible mistakes was
|
|
36
|
+
// made, and the answer is always the same one — that is not the token you were given.
|
|
37
|
+
throw new SdkAuthError(`prefix:${CONNECT_TOKEN_PREFIX}`);
|
|
38
|
+
}
|
|
39
|
+
const service = opts.service ?? 'viable-manager-api';
|
|
40
|
+
const url = new URL(opts.apiUrl);
|
|
41
|
+
// NOT `addWebService`: that names the backend service as `cfg.webService`, which is the alias of
|
|
42
|
+
// the API CLIENT rather than of the backend — the entrypoint handler resolves
|
|
43
|
+
// `context.service(cfg.webService)` and would look for a service registered under the backend's
|
|
44
|
+
// name, failing every call with `Service <name> not found`. Left unset, `appendApiClient` inside
|
|
45
|
+
// `makeClientContext` claims it for the client it registers, and the backend descriptor below is
|
|
46
|
+
// reached through the route's own address because it is this context's default backend.
|
|
47
|
+
const cfg = {
|
|
48
|
+
ready: false,
|
|
49
|
+
service: SDK_SERVICE,
|
|
50
|
+
type: AppType.Frontend,
|
|
51
|
+
layer: undefined,
|
|
52
|
+
services: {
|
|
53
|
+
[service]: {
|
|
54
|
+
service,
|
|
55
|
+
type: AppType.Backend,
|
|
56
|
+
host: url.hostname,
|
|
57
|
+
...(url.port !== '' ? { port: Number(url.port) } : {}),
|
|
58
|
+
base: url.pathname === '/' ? undefined : url.pathname.replace(/^\/|\/$/g, ''),
|
|
59
|
+
secure: url.protocol === 'https:',
|
|
60
|
+
default: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const context = makeClientContext(cfg);
|
|
65
|
+
context.registerService(makeTokenCarrierGuard(DEFAULT_GUARD, {
|
|
66
|
+
token: opts.token,
|
|
67
|
+
// The scheme the platform's own guard claims first; `Bearer` is accepted too, and is what a
|
|
68
|
+
// host configured with a bare URL will send.
|
|
69
|
+
scheme: 'auth-token',
|
|
70
|
+
}));
|
|
71
|
+
context.registerMiddleware(authMiddleware);
|
|
72
|
+
const surface = connectEntrypoints({
|
|
73
|
+
guard: DEFAULT_GUARD,
|
|
74
|
+
updateBase: UPDATE_BASE,
|
|
75
|
+
});
|
|
76
|
+
// The socket route hangs under the platform's own websocket base, so that base has to exist
|
|
77
|
+
// here too — a parent a registry cannot resolve fails the whole context at init, not the one
|
|
78
|
+
// call that would have used it. Declared with the path the platform declares, never elevated:
|
|
79
|
+
// it is a namespace, and nothing calls it.
|
|
80
|
+
const parent = entrypoint(route(UPDATE_BASE, '/update'));
|
|
81
|
+
const entrypoints = [parent, ...surface];
|
|
82
|
+
// Client elevation is what makes an alias callable from this side — the same list the server
|
|
83
|
+
// mounts, so a path or a schema cannot be right on one end and wrong on the other.
|
|
84
|
+
for (const declared of surface) {
|
|
85
|
+
elevate(entrypoints, declared.route.route.alias);
|
|
86
|
+
}
|
|
87
|
+
context.registerEntrypoints(entrypoints);
|
|
88
|
+
await context.configure().init();
|
|
89
|
+
return context;
|
|
90
|
+
};
|
|
91
|
+
export { connect };
|
|
92
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE7D;;;;;GAKG;AACH,MAAM,WAAW,GAAG,gCAAgC,CAAA;AASpD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,IAAuB,EAAwC,EAAE;IACpG,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;QACtB,MAAM,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACjD,yFAAyF;QACzF,6FAA6F;QAC7F,sFAAsF;QACtF,MAAM,IAAI,YAAY,C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A;IAE1C,MAAM,OAAO,GAAG,kBAAkB,CAAC;QACjC,KAAK,EAAE,aAAa;QACpB,UAAU,EAAE,WAAW;KACxB,CAAC,CAAA;IAEF,4FAA4F;IAC5F,6FAA6F;IAC7F,8FAA8F;IAC9F,2CAA2C;IAC3C,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAA;IACxD,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAA;IAExC,6FAA6F;IAC7F,mFAAmF;IACnF,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAA;IAExC,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,CAAA;IAEhC,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ResilientError } from '@owlmeans/error';
|
|
2
|
+
export declare class SdkError extends ResilientError {
|
|
3
|
+
static typeName: string;
|
|
4
|
+
constructor(message?: string);
|
|
5
|
+
}
|
|
6
|
+
/** The token is absent, malformed, or was refused. */
|
|
7
|
+
export declare class SdkAuthError extends SdkError {
|
|
8
|
+
static typeName: string;
|
|
9
|
+
constructor(message?: string);
|
|
10
|
+
}
|
|
11
|
+
/** The connector was started without something it cannot work out for itself. */
|
|
12
|
+
export declare class SdkMisconfigured extends SdkError {
|
|
13
|
+
static typeName: string;
|
|
14
|
+
constructor(message?: string);
|
|
15
|
+
}
|
|
16
|
+
/** A tool was called in a mode where it cannot work — a local operation on a cloud target. */
|
|
17
|
+
export declare class SdkUnsupported extends SdkError {
|
|
18
|
+
static typeName: string;
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,qBAAa,QAAS,SAAQ,cAAc;IAC1C,OAAuB,QAAQ,SAAwC;IAEvE,YAAY,OAAO,GAAE,MAAgB,EAEpC;CACF;AAED,sDAAsD;AACtD,qBAAa,YAAa,SAAQ,QAAQ;IACxC,OAAuB,QAAQ,SAA6B;IAE5D,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF;AAED,iFAAiF;AACjF,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,OAAuB,QAAQ,SAAsC;IAErE,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF;AAED,8FAA8F;AAC9F,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,OAAuB,QAAQ,SAAoC;IAEnE,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF"}
|
package/build/errors.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ResilientError } from '@owlmeans/error';
|
|
2
|
+
export class SdkError extends ResilientError {
|
|
3
|
+
static typeName = `ViableSdk${ResilientError.typeName}`;
|
|
4
|
+
constructor(message = 'error') {
|
|
5
|
+
super(SdkError.typeName, `viable-sdk:${message}`);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** The token is absent, malformed, or was refused. */
|
|
9
|
+
export class SdkAuthError extends SdkError {
|
|
10
|
+
static typeName = `Auth${SdkError.typeName}`;
|
|
11
|
+
constructor(message = 'error') {
|
|
12
|
+
super(`auth:${message}`);
|
|
13
|
+
this.type = SdkAuthError.typeName;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** The connector was started without something it cannot work out for itself. */
|
|
17
|
+
export class SdkMisconfigured extends SdkError {
|
|
18
|
+
static typeName = `Misconfigured${SdkError.typeName}`;
|
|
19
|
+
constructor(message = 'error') {
|
|
20
|
+
super(`misconfigured:${message}`);
|
|
21
|
+
this.type = SdkMisconfigured.typeName;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** A tool was called in a mode where it cannot work — a local operation on a cloud target. */
|
|
25
|
+
export class SdkUnsupported extends SdkError {
|
|
26
|
+
static typeName = `Unsupported${SdkError.typeName}`;
|
|
27
|
+
constructor(message = 'error') {
|
|
28
|
+
super(`unsupported:${message}`);
|
|
29
|
+
this.type = SdkUnsupported.typeName;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
ResilientError.registerErrorClass(SdkError);
|
|
33
|
+
ResilientError.registerErrorClass(SdkAuthError);
|
|
34
|
+
ResilientError.registerErrorClass(SdkMisconfigured);
|
|
35
|
+
ResilientError.registerErrorClass(SdkUnsupported);
|
|
36
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,OAAO,QAAS,SAAQ,cAAc;IACnC,MAAM,CAAU,QAAQ,GAAG,YAAY,cAAc,CAAC,QAAQ,EAAE,CAAA;IAEvE,YAAY,OAAO,GAAW,OAAO;QACnC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,OAAO,EAAE,CAAC,CAAA;IACnD,CAAC;CACF;AAED,sDAAsD;AACtD,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACjC,MAAM,CAAU,QAAQ,GAAG,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAA;IAE5D,YAAY,OAAO,GAAW,OAAO;QACnC,KAAK,CAAC,QAAQ,OAAO,EAAE,CAAC,CAAA;QACxB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAA;IACnC,CAAC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