@junejuly-lockstep/sdk 0.2.0 → 0.2.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 +15 -12
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/ingest.d.ts +0 -32
- package/dist/ingest.d.ts.map +0 -1
- package/dist/ingest.js +0 -60
- package/dist/ingest.js.map +0 -1
- package/dist/session.d.ts +0 -1092
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -185
- package/dist/session.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# @junejuly-lockstep/sdk
|
|
2
2
|
|
|
3
|
-
A typed `fetch` client for the Lockstep platform API
|
|
3
|
+
A typed `fetch` client for the Lockstep platform API, used by `@junejuly-lockstep/cli`. Three
|
|
4
|
+
clients:
|
|
4
5
|
|
|
5
|
-
- `
|
|
6
|
-
covers
|
|
7
|
-
|
|
8
|
-
- `
|
|
9
|
-
|
|
6
|
+
- `createCheckClient` authenticates with a project API key (`lsk_...`, sent as a bearer token) and
|
|
7
|
+
covers what `lockstep check` needs: presigned screenshot uploads, `POST /api/ingest/checks` and
|
|
8
|
+
the intent manifest.
|
|
9
|
+
- `createDeviceClient` runs the CLI device authorization (`lockstep init`): request a code, then
|
|
10
|
+
poll until a signed-in member approves it and the project API key comes back.
|
|
11
|
+
- `createAgentClient` (project API key) gives coding agents ticket context: the project, tickets,
|
|
12
|
+
a ticket's context and screens, and linking a pull request, comments and agent runs to a ticket.
|
|
10
13
|
|
|
11
14
|
Every response is validated with the `@junejuly-lockstep/model` schemas before it is returned; failures
|
|
12
15
|
surface as `LockstepApiError` (HTTP status and body) or `LockstepNetworkError` (retries exhausted).
|
|
@@ -21,16 +24,16 @@ pnpm add @junejuly-lockstep/sdk @junejuly-lockstep/model
|
|
|
21
24
|
## Usage
|
|
22
25
|
|
|
23
26
|
```ts
|
|
24
|
-
import {
|
|
27
|
+
import { createAgentClient, LockstepApiError } from '@junejuly-lockstep/sdk';
|
|
25
28
|
|
|
26
|
-
const
|
|
29
|
+
const agent = createAgentClient({
|
|
27
30
|
baseUrl: 'https://api.lockstep.example',
|
|
28
31
|
apiKey: process.env.LOCKSTEP_API_KEY!,
|
|
29
32
|
});
|
|
30
33
|
|
|
31
34
|
try {
|
|
32
|
-
const
|
|
33
|
-
console.log(`${
|
|
35
|
+
const tickets = await agent.listTickets(['todo', 'in_progress']);
|
|
36
|
+
console.log(`${tickets.length} open tickets`);
|
|
34
37
|
} catch (err) {
|
|
35
38
|
if (err instanceof LockstepApiError) console.error(err.status, err.message);
|
|
36
39
|
else throw err;
|
|
@@ -38,7 +41,7 @@ try {
|
|
|
38
41
|
```
|
|
39
42
|
|
|
40
43
|
`@junejuly-lockstep/sdk/testing` exports `fakeFetch`, a recording `fetch` double for unit tests of code that
|
|
41
|
-
uses
|
|
44
|
+
uses any client.
|
|
42
45
|
|
|
43
46
|
Published from the [Lockstep monorepo](https://github.com/JuneJulyHealth/lockstep)
|
|
44
|
-
(`packages/sdk`). Versioned in lockstep with `@junejuly-lockstep/model` and `@junejuly-lockstep/
|
|
47
|
+
(`packages/sdk`). Versioned in lockstep with `@junejuly-lockstep/model` and `@junejuly-lockstep/cli`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export { LockstepApiError, LockstepNetworkError } from './errors.js';
|
|
2
|
-
export { createIngestClient, INGEST_ROUTES } from './ingest.js';
|
|
3
|
-
export type { IngestClient, IngestClientOptions } from './ingest.js';
|
|
4
|
-
export { createSessionClient, SESSION_ROUTES } from './session.js';
|
|
5
|
-
export type { ConditionalOptions, JudgmentAction, RunArtifactsResponse, SessionClient, SessionClientOptions, } from './session.js';
|
|
6
2
|
export { AGENT_ROUTES, CHECK_ROUTES, DEVICE_ROUTES, createAgentClient, createCheckClient, createDeviceClient, } from './v2.js';
|
|
7
3
|
export type { AgentClient, ApiKeyClientOptions, CheckClient, DeviceClient, DeviceClientOptions, } from './v2.js';
|
|
8
4
|
export { joinUrl, DEFAULT_RETRY } from './http.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { LockstepApiError, LockstepNetworkError } from './errors.js';
|
|
2
|
-
export { createIngestClient, INGEST_ROUTES } from './ingest.js';
|
|
3
|
-
export { createSessionClient, SESSION_ROUTES } from './session.js';
|
|
4
2
|
export { AGENT_ROUTES, CHECK_ROUTES, DEVICE_ROUTES, createAgentClient, createCheckClient, createDeviceClient, } from './v2.js';
|
|
5
3
|
export { joinUrl, DEFAULT_RETRY } from './http.js';
|
|
6
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAQjB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junejuly-lockstep/sdk",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Typed fetch client for the Lockstep platform:
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Typed fetch client for the Lockstep platform: check ingest, CLI device authorization and agent (ticket) clients.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"zod": "^3.24.1",
|
|
48
|
-
"@junejuly-lockstep/model": "0.2.
|
|
48
|
+
"@junejuly-lockstep/model": "0.2.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"typescript": "^5.7.2",
|
|
52
52
|
"vitest": "^2.1.8"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
|
-
"build": "tsc -p tsconfig.json",
|
|
55
|
+
"build": "node -e \"for (const p of ['dist','tsconfig.tsbuildinfo']) require('node:fs').rmSync(p,{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
56
56
|
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
|
|
57
57
|
"lint": "eslint src",
|
|
58
58
|
"test": "vitest run"
|
package/dist/ingest.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { BaselineManifest, IngestRunResponse, ModelSyncPayload, ModelSyncResponse, PresignRequest, PresignResponse, RunPayload } from '@junejuly-lockstep/model';
|
|
2
|
-
import { type FetchLike, type RetryPolicy } from './http.js';
|
|
3
|
-
export interface IngestClientOptions {
|
|
4
|
-
/** Platform API origin, e.g. https://api.lockstep.example */
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
/** Project API key, `lsk_...`. Sent as `Authorization: Bearer`. */
|
|
7
|
-
apiKey: string;
|
|
8
|
-
fetch?: FetchLike;
|
|
9
|
-
retry?: Partial<RetryPolicy>;
|
|
10
|
-
}
|
|
11
|
-
/** Routes the reconciler uses. Kept in one place so the API can be reconciled against them. */
|
|
12
|
-
export declare const INGEST_ROUTES: {
|
|
13
|
-
readonly presign: "/api/ingest/presign";
|
|
14
|
-
readonly runs: "/api/ingest/runs";
|
|
15
|
-
readonly baselines: "/api/ingest/baselines";
|
|
16
|
-
readonly models: "/api/ingest/models";
|
|
17
|
-
};
|
|
18
|
-
export interface IngestClient {
|
|
19
|
-
/** POST /api/ingest/presign: batch presigned PUT URLs (max 50 files per call). */
|
|
20
|
-
presign(req: PresignRequest): Promise<PresignResponse>;
|
|
21
|
-
/** GET /api/ingest/baselines?project=KEY: current approved baselines with presigned GET URLs. */
|
|
22
|
-
getBaselines(projectKey: string): Promise<BaselineManifest>;
|
|
23
|
-
/** POST /api/ingest/runs: the complete run payload. */
|
|
24
|
-
postRun(payload: RunPayload): Promise<IngestRunResponse>;
|
|
25
|
-
/**
|
|
26
|
-
* POST /api/ingest/models: parsed journey models and scenarios at a commit (M3 model sync, run
|
|
27
|
-
* by `lockstep sync-models` in client CI on push; the platform never evaluates journey files).
|
|
28
|
-
*/
|
|
29
|
-
syncModels(payload: ModelSyncPayload): Promise<ModelSyncResponse>;
|
|
30
|
-
}
|
|
31
|
-
export declare function createIngestClient(options: IngestClientOptions): IngestClient;
|
|
32
|
-
//# sourceMappingURL=ingest.d.ts.map
|
package/dist/ingest.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,UAAU,EACX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAEzE,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC9B;AAED,+FAA+F;AAC/F,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,MAAM,WAAW,YAAY;IAC3B,kFAAkF;IAClF,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACvD,iGAAiG;IACjG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,uDAAuD;IACvD,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzD;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACnE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAiD7E"}
|
package/dist/ingest.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { BaselineManifest, IngestRunResponse, ModelSyncPayload, ModelSyncResponse, PresignRequest, PresignResponse, RunPayload, } from '@junejuly-lockstep/model';
|
|
2
|
-
import { createHttp } from './http.js';
|
|
3
|
-
/** Routes the reconciler uses. Kept in one place so the API can be reconciled against them. */
|
|
4
|
-
export const INGEST_ROUTES = {
|
|
5
|
-
presign: '/api/ingest/presign',
|
|
6
|
-
runs: '/api/ingest/runs',
|
|
7
|
-
baselines: '/api/ingest/baselines',
|
|
8
|
-
models: '/api/ingest/models',
|
|
9
|
-
};
|
|
10
|
-
export function createIngestClient(options) {
|
|
11
|
-
if (!options.apiKey)
|
|
12
|
-
throw new Error('createIngestClient: apiKey is required');
|
|
13
|
-
if (!options.apiKey.startsWith('lsk_')) {
|
|
14
|
-
throw new Error('createIngestClient: apiKey must be a project key starting with lsk_');
|
|
15
|
-
}
|
|
16
|
-
const http = createHttp({
|
|
17
|
-
baseUrl: options.baseUrl,
|
|
18
|
-
fetch: options.fetch,
|
|
19
|
-
retry: options.retry,
|
|
20
|
-
headers: { authorization: `Bearer ${options.apiKey}` },
|
|
21
|
-
});
|
|
22
|
-
return {
|
|
23
|
-
async presign(req) {
|
|
24
|
-
const body = PresignRequest.parse(req);
|
|
25
|
-
return http.request({
|
|
26
|
-
method: 'POST',
|
|
27
|
-
path: INGEST_ROUTES.presign,
|
|
28
|
-
body,
|
|
29
|
-
schema: PresignResponse,
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
async getBaselines(projectKey) {
|
|
33
|
-
return http.request({
|
|
34
|
-
method: 'GET',
|
|
35
|
-
path: INGEST_ROUTES.baselines,
|
|
36
|
-
query: { project: projectKey },
|
|
37
|
-
schema: BaselineManifest,
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
async postRun(payload) {
|
|
41
|
-
const body = RunPayload.parse(payload);
|
|
42
|
-
return http.request({
|
|
43
|
-
method: 'POST',
|
|
44
|
-
path: INGEST_ROUTES.runs,
|
|
45
|
-
body,
|
|
46
|
-
schema: IngestRunResponse,
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
async syncModels(payload) {
|
|
50
|
-
const body = ModelSyncPayload.parse(payload);
|
|
51
|
-
return http.request({
|
|
52
|
-
method: 'POST',
|
|
53
|
-
path: INGEST_ROUTES.models,
|
|
54
|
-
body,
|
|
55
|
-
schema: ModelSyncResponse,
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=ingest.js.map
|
package/dist/ingest.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,UAAU,GACX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAoC,MAAM,WAAW,CAAC;AAWzE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,qBAAqB;IAC9B,IAAI,EAAE,kBAAkB;IACxB,SAAS,EAAE,uBAAuB;IAClC,MAAM,EAAE,oBAAoB;CACpB,CAAC;AAgBX,MAAM,UAAU,kBAAkB,CAAC,OAA4B;IAC7D,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC/E,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM,IAAI,GAAG,UAAU,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,OAAO,CAAC,MAAM,EAAE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