@compilr-dev/sdk 0.29.3 → 0.29.5
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/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/platform/project-patch.d.ts +52 -0
- package/dist/platform/project-patch.js +69 -0
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -110,6 +110,8 @@ export type { FileEpisodeStoreOptions, EpisodeRecorderConfig, WorkSummaryAnchorC
|
|
|
110
110
|
export { resolveNext, evaluateBranchCondition, walkPastBranches, lookupLabel, applyBacktrack, } from './flow-runner/index.js';
|
|
111
111
|
export type { BacktrackResult } from './flow-runner/index.js';
|
|
112
112
|
export { readMCPConfigFile, writeMCPConfigFile, resolveServerEntry, loadMCPServers, saveMCPServerEntry, deleteMCPServerEntry, getServerNames, readMCPConfig, assertWritable, canConnect, } from './mcp-config.js';
|
|
113
|
+
export { buildProjectUpdate } from './platform/project-patch.js';
|
|
114
|
+
export type { ProjectPatch, ProjectUpdateResult } from './platform/project-patch.js';
|
|
113
115
|
export type { MCPServerEntry, MCPConfigFile, ResolvedMCPServer, MCPConfigRead, ConfigValue, } from './mcp-config.js';
|
|
114
116
|
export { serverHealth, needsAttention, describeHealth, estimateToolTokens, estimateServerCost, formatTokens, disabledTools, isToolEnabled, setToolEnabled, filterMcpToolsByEnablement, isSecretRef, secretRefFor, parseSecretRef, looksLikeSecret, resolveValues, describeMissing, planSecretStorage, toStoredValues, secretRefsOf, } from './mcp/index.js';
|
|
115
117
|
export type { MCPServerHealth, MCPServerState, MCPConnectionStatus, HealthInput, MCPToolShape, ServerCost, SecretRef, ResolveResult, } from './mcp/index.js';
|
package/dist/index.js
CHANGED
|
@@ -233,6 +233,8 @@ export { resolveNext, evaluateBranchCondition, walkPastBranches, lookupLabel, ap
|
|
|
233
233
|
// Shared MCP Configuration
|
|
234
234
|
// =============================================================================
|
|
235
235
|
export { readMCPConfigFile, writeMCPConfigFile, resolveServerEntry, loadMCPServers, saveMCPServerEntry, deleteMCPServerEntry, getServerNames, readMCPConfig, assertWritable, canConnect, } from './mcp-config.js';
|
|
236
|
+
// Projects — the one allow-list both hosts write through (projects-restyling Phase 5)
|
|
237
|
+
export { buildProjectUpdate } from './platform/project-patch.js';
|
|
236
238
|
// MCP — health, per-tool enablement, secrets, cost (mcp-restyling Phase 1)
|
|
237
239
|
export { serverHealth, needsAttention, describeHealth, estimateToolTokens, estimateServerCost, formatTokens, disabledTools, isToolEnabled, setToolEnabled, filterMcpToolsByEnablement, isSecretRef, secretRefFor, parseSecretRef, looksLikeSecret, resolveValues, describeMissing, planSecretStorage, toStoredValues, secretRefsOf, } from './mcp/index.js';
|
|
238
240
|
// =============================================================================
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a person may change about a project, and how it maps to the repository.
|
|
3
|
+
*
|
|
4
|
+
* ⚠️ ONE ALLOW-LIST, IN THE SDK, BECAUSE BOTH HOSTS WRITE PROJECTS. Desktop and the CLI each had
|
|
5
|
+
* their own hand-written snake_case mapping, and they had already drifted: the CLI turned an empty
|
|
6
|
+
* string into `undefined`, so a git remote could be set there but never CLEARED, while Desktop
|
|
7
|
+
* treated `''` as a deliberate clear. Same screen, same field, two different meanings for erasing
|
|
8
|
+
* it.
|
|
9
|
+
*
|
|
10
|
+
* ⚠️ AN ALLOW-LIST, NOT A SPREAD. `UpdateProjectInput` reaches machine state — `current_item_id`,
|
|
11
|
+
* `last_context`, `metadata` — and the SLUG via `name`. `projects.name` is UNIQUE NOT NULL and a
|
|
12
|
+
* real key, so an editor that could set it by sending one extra field could collide it or break
|
|
13
|
+
* every reference to it. The slug is derived at creation and frozen.
|
|
14
|
+
*/
|
|
15
|
+
import type { UpdateProjectInput } from './types.js';
|
|
16
|
+
/** The camelCase fields an editor may write. Deliberately narrower than UpdateProjectInput. */
|
|
17
|
+
export interface ProjectPatch {
|
|
18
|
+
displayName?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Where the project lives.
|
|
22
|
+
*
|
|
23
|
+
* ⚠️ RE-POINTS THE PROJECT; IT DOES NOT MOVE ANYTHING. This is how a project whose folder was
|
|
24
|
+
* moved on disk is repaired — a host offering it should say so, because "Path" reads like a
|
|
25
|
+
* thing that relocates files.
|
|
26
|
+
*/
|
|
27
|
+
path?: string;
|
|
28
|
+
docsPath?: string;
|
|
29
|
+
language?: string;
|
|
30
|
+
framework?: string;
|
|
31
|
+
packageManager?: string;
|
|
32
|
+
runtimeVersion?: string;
|
|
33
|
+
gitRemote?: string;
|
|
34
|
+
gitBranch?: string;
|
|
35
|
+
workflowMode?: string;
|
|
36
|
+
status?: string;
|
|
37
|
+
}
|
|
38
|
+
export type ProjectUpdateResult = {
|
|
39
|
+
ok: true;
|
|
40
|
+
input: UpdateProjectInput;
|
|
41
|
+
} | {
|
|
42
|
+
ok: false;
|
|
43
|
+
error: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Map a patch onto the repository's input, or refuse it.
|
|
47
|
+
*
|
|
48
|
+
* ⚠️ AN EMPTY STRING IS A DELIBERATE CLEAR, NOT "LEAVE ALONE". Only `undefined` means untouched.
|
|
49
|
+
* Clearing a git remote has to be possible, and a host that cannot do it has no way to undo a
|
|
50
|
+
* typo in one.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildProjectUpdate(patch: ProjectPatch): ProjectUpdateResult;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a person may change about a project, and how it maps to the repository.
|
|
3
|
+
*
|
|
4
|
+
* ⚠️ ONE ALLOW-LIST, IN THE SDK, BECAUSE BOTH HOSTS WRITE PROJECTS. Desktop and the CLI each had
|
|
5
|
+
* their own hand-written snake_case mapping, and they had already drifted: the CLI turned an empty
|
|
6
|
+
* string into `undefined`, so a git remote could be set there but never CLEARED, while Desktop
|
|
7
|
+
* treated `''` as a deliberate clear. Same screen, same field, two different meanings for erasing
|
|
8
|
+
* it.
|
|
9
|
+
*
|
|
10
|
+
* ⚠️ AN ALLOW-LIST, NOT A SPREAD. `UpdateProjectInput` reaches machine state — `current_item_id`,
|
|
11
|
+
* `last_context`, `metadata` — and the SLUG via `name`. `projects.name` is UNIQUE NOT NULL and a
|
|
12
|
+
* real key, so an editor that could set it by sending one extra field could collide it or break
|
|
13
|
+
* every reference to it. The slug is derived at creation and frozen.
|
|
14
|
+
*/
|
|
15
|
+
/*
|
|
16
|
+
⚠️ `path` IS NOT IN HERE. `UpdateProjectInput` has no `path` key — it is written through the
|
|
17
|
+
repository's own column — so listing it beside the others would have needed a lie in the type.
|
|
18
|
+
It is handled explicitly in the loop, where the difference is visible.
|
|
19
|
+
*/
|
|
20
|
+
const FIELD_MAP = {
|
|
21
|
+
displayName: 'display_name',
|
|
22
|
+
description: 'description',
|
|
23
|
+
docsPath: 'docs_path',
|
|
24
|
+
language: 'language',
|
|
25
|
+
framework: 'framework',
|
|
26
|
+
packageManager: 'package_manager',
|
|
27
|
+
runtimeVersion: 'runtime_version',
|
|
28
|
+
gitRemote: 'git_remote',
|
|
29
|
+
gitBranch: 'git_branch',
|
|
30
|
+
workflowMode: 'workflow_mode',
|
|
31
|
+
status: 'status',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Map a patch onto the repository's input, or refuse it.
|
|
35
|
+
*
|
|
36
|
+
* ⚠️ AN EMPTY STRING IS A DELIBERATE CLEAR, NOT "LEAVE ALONE". Only `undefined` means untouched.
|
|
37
|
+
* Clearing a git remote has to be possible, and a host that cannot do it has no way to undo a
|
|
38
|
+
* typo in one.
|
|
39
|
+
*/
|
|
40
|
+
export function buildProjectUpdate(patch) {
|
|
41
|
+
const displayName = patch.displayName?.trim();
|
|
42
|
+
if (displayName !== undefined && displayName === '') {
|
|
43
|
+
return { ok: false, error: 'A project needs a name.' };
|
|
44
|
+
}
|
|
45
|
+
const path = patch.path?.trim();
|
|
46
|
+
if (path !== undefined && path === '') {
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
error: 'A project needs a path — clearing it would lose track of the folder.',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const input = {};
|
|
53
|
+
if (path !== undefined)
|
|
54
|
+
input.path = path;
|
|
55
|
+
for (const key of Object.keys(FIELD_MAP)) {
|
|
56
|
+
const value = patch[key];
|
|
57
|
+
if (value === undefined)
|
|
58
|
+
continue;
|
|
59
|
+
if (key === 'displayName')
|
|
60
|
+
input.display_name = displayName;
|
|
61
|
+
else if (key === 'workflowMode')
|
|
62
|
+
input.workflow_mode = value;
|
|
63
|
+
else if (key === 'status')
|
|
64
|
+
input.status = value;
|
|
65
|
+
else
|
|
66
|
+
input[FIELD_MAP[key]] = value;
|
|
67
|
+
}
|
|
68
|
+
return { ok: true, input };
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilr-dev/sdk",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.5",
|
|
4
4
|
"description": "Universal agent runtime for building AI-powered applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
"types": "./dist/models/index.d.ts",
|
|
31
31
|
"import": "./dist/models/index.js"
|
|
32
32
|
},
|
|
33
|
+
"./mcp": {
|
|
34
|
+
"types": "./dist/mcp/index.d.ts",
|
|
35
|
+
"import": "./dist/mcp/index.js"
|
|
36
|
+
},
|
|
33
37
|
"./package.json": "./package.json"
|
|
34
38
|
},
|
|
35
39
|
"files": [
|