@mossbear/protocol 0.1.0-alpha.43 → 0.1.0-alpha.45
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/agentGuidancePaths.d.ts +27 -0
- package/dist/agentGuidancePaths.d.ts.map +1 -1
- package/dist/agentGuidancePaths.js +34 -0
- package/dist/agentGuidancePaths.js.map +1 -1
- package/dist/agentGuidancePaths.test.js +33 -1
- package/dist/agentGuidancePaths.test.js.map +1 -1
- package/dist/bundleSlug.d.ts +62 -0
- package/dist/bundleSlug.d.ts.map +1 -1
- package/dist/bundleSlug.js +96 -0
- package/dist/bundleSlug.js.map +1 -1
- package/dist/bundleSlug.test.js +88 -1
- package/dist/bundleSlug.test.js.map +1 -1
- package/dist/schemas.d.ts +51 -8
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +50 -2
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.test.js +80 -2
- package/dist/schemas.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -70,4 +70,31 @@ export declare function isAgentGuidancePath(path: string): boolean;
|
|
|
70
70
|
* symlink-escape's worth of drift away from each other (Planning Principle 14).
|
|
71
71
|
*/
|
|
72
72
|
export declare function isReservedStatePath(candidate: string): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* True when a repo-relative path is inside git's own directory — `.git/config`,
|
|
75
|
+
* `.git/hooks/pre-commit`, the `.git` gitfile a worktree or submodule keeps, or
|
|
76
|
+
* a nested repository's `.git/` further down.
|
|
77
|
+
*
|
|
78
|
+
* **Git itself refuses to track such a path** (`verify_path` rejects any `.git`
|
|
79
|
+
* component), so a project item declaring one can never be delivered by
|
|
80
|
+
* `git clone` or `git merge` — which is the only way a project item is supposed
|
|
81
|
+
* to reach a working tree. The one thing left that could write it is
|
|
82
|
+
* `mossbear accept`, and the write is not inert: git reads `.git/config` on the
|
|
83
|
+
* next `git status` and runs whatever `core.fsmonitor`, `core.hooksPath` or
|
|
84
|
+
* `core.pager` names, with no commit for anyone to review. A shared bundle is
|
|
85
|
+
* writable by every member of its workspace and by any agent holding a
|
|
86
|
+
* member's token, so the path has to be refused where it is declared and again
|
|
87
|
+
* where it would be written, the same two halves `isReservedStatePath` has.
|
|
88
|
+
*
|
|
89
|
+
* Any `.git` segment, anywhere, under git's own NTFS-aware fold
|
|
90
|
+
* (`is_ntfs_dotgit` in git's `path.c`), because the writer may be a Windows
|
|
91
|
+
* machine even when the server is not: Win32 strips trailing dots and spaces
|
|
92
|
+
* from a segment, resolves the 8.3 short name `GIT~1`, and reads `:` as an
|
|
93
|
+
* alternate data stream on the segment before it — so `.git /config`,
|
|
94
|
+
* `.git./config`, `GIT~1/config` and `.git:x/config` all land in the real
|
|
95
|
+
* `.git/`. Case-folded for the same reason. `.gitignore`, `.github/` and
|
|
96
|
+
* `docs/git.md` are ordinary paths: after the fold the segment has to be
|
|
97
|
+
* exactly `.git` or `git~1`.
|
|
98
|
+
*/
|
|
99
|
+
export declare function isGitInternalPath(candidate: string): boolean;
|
|
73
100
|
//# sourceMappingURL=agentGuidancePaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentGuidancePaths.d.ts","sourceRoot":"","sources":["../src/agentGuidancePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,MAAM,CAIrD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAItD,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYzD;AAsCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAI9D"}
|
|
1
|
+
{"version":3,"file":"agentGuidancePaths.d.ts","sourceRoot":"","sources":["../src/agentGuidancePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,MAAM,CAIrD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAItD,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYzD;AAsCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAO5D"}
|
|
@@ -134,4 +134,38 @@ export function isReservedStatePath(candidate) {
|
|
|
134
134
|
return false;
|
|
135
135
|
return !MOSSBEAR_CONTENT_SUBTREES.some((subtree) => normalized.startsWith(subtree));
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* True when a repo-relative path is inside git's own directory — `.git/config`,
|
|
139
|
+
* `.git/hooks/pre-commit`, the `.git` gitfile a worktree or submodule keeps, or
|
|
140
|
+
* a nested repository's `.git/` further down.
|
|
141
|
+
*
|
|
142
|
+
* **Git itself refuses to track such a path** (`verify_path` rejects any `.git`
|
|
143
|
+
* component), so a project item declaring one can never be delivered by
|
|
144
|
+
* `git clone` or `git merge` — which is the only way a project item is supposed
|
|
145
|
+
* to reach a working tree. The one thing left that could write it is
|
|
146
|
+
* `mossbear accept`, and the write is not inert: git reads `.git/config` on the
|
|
147
|
+
* next `git status` and runs whatever `core.fsmonitor`, `core.hooksPath` or
|
|
148
|
+
* `core.pager` names, with no commit for anyone to review. A shared bundle is
|
|
149
|
+
* writable by every member of its workspace and by any agent holding a
|
|
150
|
+
* member's token, so the path has to be refused where it is declared and again
|
|
151
|
+
* where it would be written, the same two halves `isReservedStatePath` has.
|
|
152
|
+
*
|
|
153
|
+
* Any `.git` segment, anywhere, under git's own NTFS-aware fold
|
|
154
|
+
* (`is_ntfs_dotgit` in git's `path.c`), because the writer may be a Windows
|
|
155
|
+
* machine even when the server is not: Win32 strips trailing dots and spaces
|
|
156
|
+
* from a segment, resolves the 8.3 short name `GIT~1`, and reads `:` as an
|
|
157
|
+
* alternate data stream on the segment before it — so `.git /config`,
|
|
158
|
+
* `.git./config`, `GIT~1/config` and `.git:x/config` all land in the real
|
|
159
|
+
* `.git/`. Case-folded for the same reason. `.gitignore`, `.github/` and
|
|
160
|
+
* `docs/git.md` are ordinary paths: after the fold the segment has to be
|
|
161
|
+
* exactly `.git` or `git~1`.
|
|
162
|
+
*/
|
|
163
|
+
export function isGitInternalPath(candidate) {
|
|
164
|
+
const normalized = normalizePosixRelative(candidate.replace(/\\/g, '/'));
|
|
165
|
+
return normalized.split('/').some((segment) => {
|
|
166
|
+
const streamless = segment.split(':')[0] ?? '';
|
|
167
|
+
const folded = streamless.replace(/[. ]+$/, '').toLowerCase();
|
|
168
|
+
return folded === '.git' || folded === 'git~1';
|
|
169
|
+
});
|
|
170
|
+
}
|
|
137
171
|
//# sourceMappingURL=agentGuidancePaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentGuidancePaths.js","sourceRoot":"","sources":["../src/agentGuidancePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA0B;IACxD,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B;IAC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AAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;QAC7D,OAAO,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,OAAO,CAAA;IAChD,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { isAgentGuidanceFileName, isAgentGuidancePath, isReservedStatePath, } from './agentGuidancePaths.js';
|
|
2
|
+
import { isAgentGuidanceFileName, isAgentGuidancePath, isGitInternalPath, isReservedStatePath, } from './agentGuidancePaths.js';
|
|
3
3
|
describe('isAgentGuidancePath', () => {
|
|
4
4
|
it("refuses a path that would become the repo's guidance file", () => {
|
|
5
5
|
expect(isAgentGuidancePath('AGENTS.md')).toBe(true);
|
|
@@ -51,4 +51,36 @@ describe('isReservedStatePath', () => {
|
|
|
51
51
|
expect(isReservedStatePath('docs/notes.md')).toBe(false);
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
|
+
describe('isGitInternalPath', () => {
|
|
55
|
+
it("refuses git's own directory, where a written file is read and acted on", () => {
|
|
56
|
+
expect(isGitInternalPath('.git/config')).toBe(true);
|
|
57
|
+
expect(isGitInternalPath('.git/hooks/pre-commit')).toBe(true);
|
|
58
|
+
// The gitfile a worktree or submodule checkout keeps in place of the directory.
|
|
59
|
+
expect(isGitInternalPath('.git')).toBe(true);
|
|
60
|
+
// A nested repository's directory is git's too.
|
|
61
|
+
expect(isGitInternalPath('vendor/lib/.git/config')).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
it('refuses it however it is spelled', () => {
|
|
64
|
+
expect(isGitInternalPath('docs/../.git/config')).toBe(true);
|
|
65
|
+
expect(isGitInternalPath('.GIT/config')).toBe(true);
|
|
66
|
+
expect(isGitInternalPath('.git\\config')).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
it("refuses the spellings Windows folds onto .git, the way git's own check does", () => {
|
|
69
|
+
// Win32 drops trailing dots and spaces from a segment, resolves the 8.3
|
|
70
|
+
// short name, and treats `:` as a stream on the segment before it — so each
|
|
71
|
+
// of these writes into the real `.git/` on a Windows checkout.
|
|
72
|
+
expect(isGitInternalPath('.git /config')).toBe(true);
|
|
73
|
+
expect(isGitInternalPath('.git./config')).toBe(true);
|
|
74
|
+
expect(isGitInternalPath('.git. . /config')).toBe(true);
|
|
75
|
+
expect(isGitInternalPath('GIT~1/config')).toBe(true);
|
|
76
|
+
expect(isGitInternalPath('git~1')).toBe(true);
|
|
77
|
+
expect(isGitInternalPath('.git:$INDEX_ALLOCATION/config')).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
it('allows the ordinary paths that merely start with the same letters', () => {
|
|
80
|
+
expect(isGitInternalPath('.gitignore')).toBe(false);
|
|
81
|
+
expect(isGitInternalPath('.github/CONTRIBUTING.md')).toBe(false);
|
|
82
|
+
expect(isGitInternalPath('.gitmodules')).toBe(false);
|
|
83
|
+
expect(isGitInternalPath('docs/git.md')).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
54
86
|
//# sourceMappingURL=agentGuidancePaths.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentGuidancePaths.test.js","sourceRoot":"","sources":["../src/agentGuidancePaths.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,yBAAyB,CAAA;AAEhC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnD,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnD,MAAM,CAAC,mBAAmB,CA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
28
28
|
* a committed subscription stores (plan → "A subscription names a bundle id,
|
|
29
29
|
* not a slug").
|
|
30
|
+
*
|
|
31
|
+
* **The account's *personal* bundle, since Decision 17** — a workspace's is
|
|
32
|
+
* named after its workspace. {@link defaultGuidesBundleFor} is the rule; these
|
|
33
|
+
* two constants are its personal branch and are read nowhere else.
|
|
30
34
|
*/
|
|
31
35
|
export declare const DEFAULT_GUIDES_SLUG = "my-guides";
|
|
32
36
|
/** Display name minted alongside {@link DEFAULT_GUIDES_SLUG}. */
|
|
@@ -39,4 +43,62 @@ export declare const DEFAULT_GUIDES_NAME = "My guides";
|
|
|
39
43
|
* this only picks a candidate the common case won't bounce.
|
|
40
44
|
*/
|
|
41
45
|
export declare function deriveBundleSlug(name: string, taken: ReadonlySet<string>): string;
|
|
46
|
+
/**
|
|
47
|
+
* The slug and name of the account's default guides bundle **in one workspace**
|
|
48
|
+
* (Decision 17 of the workspace-declaration design, founder 2026-09-04).
|
|
49
|
+
*
|
|
50
|
+
* Decision 13 gave an account one capture bundle per workspace, and the mint
|
|
51
|
+
* gave every one of them {@link DEFAULT_GUIDES_SLUG}. So the first import from a
|
|
52
|
+
* repo that declares a shared workspace left the account holding two bundles at
|
|
53
|
+
* one slug, and the CLI's directory disambiguation suffixes *every* member of a
|
|
54
|
+
* colliding group — renaming the user's existing `.mossbear/context/my-guides/`
|
|
55
|
+
* on their next sync and turning `mossbear pull my-guides` into a named
|
|
56
|
+
* refusal. Neither is wrong on its own: two bundles that genuinely collide
|
|
57
|
+
* should be disambiguated. These two should never have collided.
|
|
58
|
+
*
|
|
59
|
+
* So the personal workspace's bundle keeps `my-guides` — it is the one
|
|
60
|
+
* `users.default_bundle_id` names, and the one every existing repo's
|
|
61
|
+
* `.mossbear/context/my-guides/` came from — and every other workspace's is
|
|
62
|
+
* named after its workspace. The fix is here rather than in the CLI because
|
|
63
|
+
* this is where the two names are chosen.
|
|
64
|
+
*
|
|
65
|
+
* **`isPersonal` is the caller's answer, not a lookup.** It is
|
|
66
|
+
* `users.default_workspace_id === workspaceId`, and both server callers — the
|
|
67
|
+
* bundle resolver and the unlink route — already read that column for other
|
|
68
|
+
* reasons. Passing it keeps this function total: the same inputs always give
|
|
69
|
+
* the same pair, which is what lets a data migration reuse the rule without a
|
|
70
|
+
* database handle.
|
|
71
|
+
*
|
|
72
|
+
* Workspace slugs are url-safe by construction — the column is written only by
|
|
73
|
+
* the two creators, both of which normalize — and set at creation, with no
|
|
74
|
+
* route that renames one. So on the slug side the only rule left to respect is
|
|
75
|
+
* `BundleSlugSchema`'s 64-character cap.
|
|
76
|
+
*
|
|
77
|
+
* **The name side is different, and is why `displayable` exists.** A workspace
|
|
78
|
+
* *name* is free text typed by whoever created the workspace, and this is the
|
|
79
|
+
* first thing that turns one person's text into *another* person's bundle name:
|
|
80
|
+
* a member who imports from a repo declaring a shared workspace gets a bundle
|
|
81
|
+
* of their own named after it. Bundle names are printed straight into a
|
|
82
|
+
* terminal by the CLI — `unlink` renders each still-delivering bundle by name —
|
|
83
|
+
* so a carriage return or an ANSI escape in the workspace name would let its
|
|
84
|
+
* author rewrite the line a *teammate* reads about what is still reaching their
|
|
85
|
+
* agents. Stripped here because this is the point where the two meet.
|
|
86
|
+
*
|
|
87
|
+
* **The boundary refuses these now too, and this strip still stays.** The
|
|
88
|
+
* create-workspace body schema, `CreateBundleRequestSchema` and
|
|
89
|
+
* `UpdateBundleRequestSchema` each run a user-typed display name through
|
|
90
|
+
* {@link displayNameSchema} (`schemas.ts`), which *rejects* `\p{Cc}` and
|
|
91
|
+
* `\p{Cf}` rather than stripping them — a user typing a name is present and
|
|
92
|
+
* can be told, which a derivation cannot do. This one keeps stripping for the
|
|
93
|
+
* two reasons that survive that boundary: it has no user to report to, and a
|
|
94
|
+
* workspace row stored before the boundary existed can still carry one.
|
|
95
|
+
*/
|
|
96
|
+
export declare function defaultGuidesBundleFor(workspace: {
|
|
97
|
+
slug: string;
|
|
98
|
+
name: string;
|
|
99
|
+
isPersonal: boolean;
|
|
100
|
+
}): {
|
|
101
|
+
slug: string;
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
42
104
|
//# sourceMappingURL=bundleSlug.d.ts.map
|
package/dist/bundleSlug.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleSlug.d.ts","sourceRoot":"","sources":["../src/bundleSlug.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH
|
|
1
|
+
{"version":3,"file":"bundleSlug.d.ts","sourceRoot":"","sources":["../src/bundleSlug.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,cAAc,CAAA;AAE9C,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,cAAc,CAAA;AAsB9C;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAUjF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,OAAO,CAAA;CACpB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAuBjC"}
|
package/dist/bundleSlug.js
CHANGED
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
* discovers it by slug in the bundle listing to learn its **id**, which is what
|
|
28
28
|
* a committed subscription stores (plan → "A subscription names a bundle id,
|
|
29
29
|
* not a slug").
|
|
30
|
+
*
|
|
31
|
+
* **The account's *personal* bundle, since Decision 17** — a workspace's is
|
|
32
|
+
* named after its workspace. {@link defaultGuidesBundleFor} is the rule; these
|
|
33
|
+
* two constants are its personal branch and are read nowhere else.
|
|
30
34
|
*/
|
|
31
35
|
export const DEFAULT_GUIDES_SLUG = 'my-guides';
|
|
32
36
|
/** Display name minted alongside {@link DEFAULT_GUIDES_SLUG}. */
|
|
@@ -36,6 +40,8 @@ export const DEFAULT_GUIDES_NAME = 'My guides';
|
|
|
36
40
|
* alphanumeric, max 64 chars (`schemas.ts`).
|
|
37
41
|
*/
|
|
38
42
|
const MAX_SLUG_LENGTH = 64;
|
|
43
|
+
/** What {@link defaultGuidesBundleFor} appends to a workspace's own slug. */
|
|
44
|
+
const GUIDES_SUFFIX = '-guides';
|
|
39
45
|
function normalize(name) {
|
|
40
46
|
return name
|
|
41
47
|
.normalize('NFKD')
|
|
@@ -65,4 +71,94 @@ export function deriveBundleSlug(name, taken) {
|
|
|
65
71
|
return candidate;
|
|
66
72
|
}
|
|
67
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* The slug and name of the account's default guides bundle **in one workspace**
|
|
76
|
+
* (Decision 17 of the workspace-declaration design, founder 2026-09-04).
|
|
77
|
+
*
|
|
78
|
+
* Decision 13 gave an account one capture bundle per workspace, and the mint
|
|
79
|
+
* gave every one of them {@link DEFAULT_GUIDES_SLUG}. So the first import from a
|
|
80
|
+
* repo that declares a shared workspace left the account holding two bundles at
|
|
81
|
+
* one slug, and the CLI's directory disambiguation suffixes *every* member of a
|
|
82
|
+
* colliding group — renaming the user's existing `.mossbear/context/my-guides/`
|
|
83
|
+
* on their next sync and turning `mossbear pull my-guides` into a named
|
|
84
|
+
* refusal. Neither is wrong on its own: two bundles that genuinely collide
|
|
85
|
+
* should be disambiguated. These two should never have collided.
|
|
86
|
+
*
|
|
87
|
+
* So the personal workspace's bundle keeps `my-guides` — it is the one
|
|
88
|
+
* `users.default_bundle_id` names, and the one every existing repo's
|
|
89
|
+
* `.mossbear/context/my-guides/` came from — and every other workspace's is
|
|
90
|
+
* named after its workspace. The fix is here rather than in the CLI because
|
|
91
|
+
* this is where the two names are chosen.
|
|
92
|
+
*
|
|
93
|
+
* **`isPersonal` is the caller's answer, not a lookup.** It is
|
|
94
|
+
* `users.default_workspace_id === workspaceId`, and both server callers — the
|
|
95
|
+
* bundle resolver and the unlink route — already read that column for other
|
|
96
|
+
* reasons. Passing it keeps this function total: the same inputs always give
|
|
97
|
+
* the same pair, which is what lets a data migration reuse the rule without a
|
|
98
|
+
* database handle.
|
|
99
|
+
*
|
|
100
|
+
* Workspace slugs are url-safe by construction — the column is written only by
|
|
101
|
+
* the two creators, both of which normalize — and set at creation, with no
|
|
102
|
+
* route that renames one. So on the slug side the only rule left to respect is
|
|
103
|
+
* `BundleSlugSchema`'s 64-character cap.
|
|
104
|
+
*
|
|
105
|
+
* **The name side is different, and is why `displayable` exists.** A workspace
|
|
106
|
+
* *name* is free text typed by whoever created the workspace, and this is the
|
|
107
|
+
* first thing that turns one person's text into *another* person's bundle name:
|
|
108
|
+
* a member who imports from a repo declaring a shared workspace gets a bundle
|
|
109
|
+
* of their own named after it. Bundle names are printed straight into a
|
|
110
|
+
* terminal by the CLI — `unlink` renders each still-delivering bundle by name —
|
|
111
|
+
* so a carriage return or an ANSI escape in the workspace name would let its
|
|
112
|
+
* author rewrite the line a *teammate* reads about what is still reaching their
|
|
113
|
+
* agents. Stripped here because this is the point where the two meet.
|
|
114
|
+
*
|
|
115
|
+
* **The boundary refuses these now too, and this strip still stays.** The
|
|
116
|
+
* create-workspace body schema, `CreateBundleRequestSchema` and
|
|
117
|
+
* `UpdateBundleRequestSchema` each run a user-typed display name through
|
|
118
|
+
* {@link displayNameSchema} (`schemas.ts`), which *rejects* `\p{Cc}` and
|
|
119
|
+
* `\p{Cf}` rather than stripping them — a user typing a name is present and
|
|
120
|
+
* can be told, which a derivation cannot do. This one keeps stripping for the
|
|
121
|
+
* two reasons that survive that boundary: it has no user to report to, and a
|
|
122
|
+
* workspace row stored before the boundary existed can still carry one.
|
|
123
|
+
*/
|
|
124
|
+
export function defaultGuidesBundleFor(workspace) {
|
|
125
|
+
if (workspace.isPersonal) {
|
|
126
|
+
return { slug: DEFAULT_GUIDES_SLUG, name: DEFAULT_GUIDES_NAME };
|
|
127
|
+
}
|
|
128
|
+
// Truncate the workspace's half rather than the whole result, so the suffix
|
|
129
|
+
// that says what this bundle *is* survives a long workspace slug. Trailing
|
|
130
|
+
// hyphens go for the reason `deriveBundleSlug` strips them: a cut can land
|
|
131
|
+
// mid-word and `foo--guides` is uglier than it needs to be.
|
|
132
|
+
const base = workspace.slug
|
|
133
|
+
.slice(0, MAX_SLUG_LENGTH - GUIDES_SUFFIX.length)
|
|
134
|
+
.replace(/-+$/g, '');
|
|
135
|
+
// A workspace slug is never empty in practice — the column is NOT NULL and
|
|
136
|
+
// both creators derive a non-empty value — but a bare `-guides` would fail
|
|
137
|
+
// `BundleSlugSchema`'s "starts alphanumeric" rule, so the fallback is one
|
|
138
|
+
// token rather than an invariant every caller has to trust.
|
|
139
|
+
return {
|
|
140
|
+
slug: `${base || 'workspace'}${GUIDES_SUFFIX}`,
|
|
141
|
+
// `|| 'Workspace'` for the same reason the slug has a fallback: a name of
|
|
142
|
+
// nothing but control characters passes the create-workspace body schema
|
|
143
|
+
// (`v.trim()` drops whitespace, not an ESC) and would leave a bundle called
|
|
144
|
+
// " guides".
|
|
145
|
+
name: `${displayable(workspace.name) || 'Workspace'} guides`,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A name safe to print into a terminal line: Unicode control and format
|
|
150
|
+
* characters removed, whitespace runs collapsed, ends trimmed. The character
|
|
151
|
+
* class is the one `schemas.ts` already uses for ids, so the two agree about
|
|
152
|
+
* what "a control character" means.
|
|
153
|
+
*
|
|
154
|
+
* Removed rather than escaped or refused: the caller is a derivation with no
|
|
155
|
+
* user to report to, and a workspace whose name carries an ANSI escape is,
|
|
156
|
+
* as far as a bundle name is concerned, a workspace named without it.
|
|
157
|
+
*/
|
|
158
|
+
function displayable(name) {
|
|
159
|
+
return name
|
|
160
|
+
.replace(/[\p{Cc}\p{Cf}]+/gu, '')
|
|
161
|
+
.replace(/\s+/g, ' ')
|
|
162
|
+
.trim();
|
|
163
|
+
}
|
|
68
164
|
//# sourceMappingURL=bundleSlug.js.map
|
package/dist/bundleSlug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleSlug.js","sourceRoot":"","sources":["../src/bundleSlug.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH
|
|
1
|
+
{"version":3,"file":"bundleSlug.js","sourceRoot":"","sources":["../src/bundleSlug.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAA;AAE9C,iEAAiE;AACjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAA;AAE9C;;;GAGG;AACH,MAAM,eAAe,GAAG,EAAE,CAAA;AAE1B,6EAA6E;AAC7E,MAAM,aAAa,GAAG,SAAS,CAAA;AAE/B,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI;SACR,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC;SACzB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACxB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,KAA0B;IACvE,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAA;IACxC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAEjD,IAAI,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA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,CAAA;AACX,CAAC"}
|
package/dist/bundleSlug.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { deriveBundleSlug } from './bundleSlug.js';
|
|
2
|
+
import { defaultGuidesBundleFor, deriveBundleSlug } from './bundleSlug.js';
|
|
3
3
|
const none = new Set();
|
|
4
4
|
describe('deriveBundleSlug', () => {
|
|
5
5
|
it('kebab-cases a plain name', () => {
|
|
@@ -40,4 +40,91 @@ describe('deriveBundleSlug', () => {
|
|
|
40
40
|
expect(slug.length).toBeLessThanOrEqual(64);
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
|
+
describe('defaultGuidesBundleFor', () => {
|
|
44
|
+
it("keeps `my-guides` for the account's personal workspace", () => {
|
|
45
|
+
expect(defaultGuidesBundleFor({ slug: 'personal', name: 'Personal', isPersonal: true })).toEqual({ slug: 'my-guides', name: 'My guides' });
|
|
46
|
+
});
|
|
47
|
+
it("names another workspace's bundle after that workspace", () => {
|
|
48
|
+
expect(defaultGuidesBundleFor({ slug: 'acme-a1b2c3', name: 'Acme', isPersonal: false })).toEqual({ slug: 'acme-a1b2c3-guides', name: 'Acme guides' });
|
|
49
|
+
});
|
|
50
|
+
it('gives two workspaces of one account two distinct slugs', () => {
|
|
51
|
+
const personal = defaultGuidesBundleFor({
|
|
52
|
+
slug: 'personal',
|
|
53
|
+
name: 'Personal',
|
|
54
|
+
isPersonal: true,
|
|
55
|
+
});
|
|
56
|
+
const shared = defaultGuidesBundleFor({
|
|
57
|
+
slug: 'personal',
|
|
58
|
+
name: 'Personal',
|
|
59
|
+
isPersonal: false,
|
|
60
|
+
});
|
|
61
|
+
// Same workspace slug on both sides, so the personal flag is doing the
|
|
62
|
+
// whole job: a shared workspace that happens to be called "personal" still
|
|
63
|
+
// does not collide with the bundle `users.default_bundle_id` names.
|
|
64
|
+
expect(shared.slug).not.toBe(personal.slug);
|
|
65
|
+
});
|
|
66
|
+
it('stays within the 64-char cap `BundleSlugSchema` enforces', () => {
|
|
67
|
+
const { slug } = defaultGuidesBundleFor({
|
|
68
|
+
slug: 'w'.repeat(80),
|
|
69
|
+
name: 'Long',
|
|
70
|
+
isPersonal: false,
|
|
71
|
+
});
|
|
72
|
+
expect(slug.length).toBe(64);
|
|
73
|
+
expect(slug.endsWith('-guides')).toBe(true);
|
|
74
|
+
expect(slug).toMatch(/^[a-z0-9][a-z0-9-]*$/);
|
|
75
|
+
});
|
|
76
|
+
it('does not double the hyphen when truncation lands on one', () => {
|
|
77
|
+
const { slug } = defaultGuidesBundleFor({
|
|
78
|
+
// 57 characters ending in a hyphen — exactly where the cut falls.
|
|
79
|
+
slug: `${'w'.repeat(56)}-tail`,
|
|
80
|
+
name: 'Long',
|
|
81
|
+
isPersonal: false,
|
|
82
|
+
});
|
|
83
|
+
expect(slug).toBe(`${'w'.repeat(56)}-guides`);
|
|
84
|
+
expect(slug).toMatch(/^[a-z0-9][a-z0-9-]*$/);
|
|
85
|
+
});
|
|
86
|
+
it('falls back to a valid slug when a workspace slug is empty', () => {
|
|
87
|
+
expect(defaultGuidesBundleFor({ slug: '', name: 'Nameless', isPersonal: false })).toEqual({ slug: 'workspace-guides', name: 'Nameless guides' });
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
describe('defaultGuidesBundleFor — the name a teammate ends up reading', () => {
|
|
91
|
+
// A workspace name is typed by whoever created the workspace, and a member who
|
|
92
|
+
// imports from a repo declaring it gets a bundle of their own named after it.
|
|
93
|
+
// The CLI prints bundle names straight into a terminal line, so without this
|
|
94
|
+
// the workspace's author could rewrite what a teammate reads.
|
|
95
|
+
const ESC = String.fromCharCode(27);
|
|
96
|
+
const CR = String.fromCharCode(13);
|
|
97
|
+
it('strips the ESC that arms an ANSI sequence, leaving inert text', () => {
|
|
98
|
+
// Only the ESC is removed, and only the ESC needs to be: `[31m` on its own
|
|
99
|
+
// is ordinary printable text that colours nothing and moves no cursor. The
|
|
100
|
+
// assertion says so rather than pretending the whole sequence disappears.
|
|
101
|
+
const { name } = defaultGuidesBundleFor({
|
|
102
|
+
slug: 'acme',
|
|
103
|
+
name: `Acme${ESC}[31m`,
|
|
104
|
+
isPersonal: false,
|
|
105
|
+
});
|
|
106
|
+
expect(name).not.toContain(ESC);
|
|
107
|
+
expect(name).toBe('Acme[31m guides');
|
|
108
|
+
});
|
|
109
|
+
it('strips a carriage return, which is what rewrites the line', () => {
|
|
110
|
+
const { name } = defaultGuidesBundleFor({
|
|
111
|
+
slug: 'acme',
|
|
112
|
+
name: `Acme${CR}Still delivered by another bundle: nothing`,
|
|
113
|
+
isPersonal: false,
|
|
114
|
+
});
|
|
115
|
+
expect(name).not.toContain(CR);
|
|
116
|
+
expect(name).toBe('AcmeStill delivered by another bundle: nothing guides');
|
|
117
|
+
});
|
|
118
|
+
it('collapses whitespace runs and trims, so padding cannot push text off a line', () => {
|
|
119
|
+
expect(defaultGuidesBundleFor({ slug: 'acme', name: ' Acme Team ', isPersonal: false })
|
|
120
|
+
.name).toBe('Acme Team guides');
|
|
121
|
+
});
|
|
122
|
+
it('falls back when nothing survives, rather than naming a bundle " guides"', () => {
|
|
123
|
+
expect(defaultGuidesBundleFor({ slug: 'acme', name: `${ESC}${CR}`, isPersonal: false })
|
|
124
|
+
.name).toBe('Workspace guides');
|
|
125
|
+
});
|
|
126
|
+
it('leaves an ordinary name, including non-ASCII, alone', () => {
|
|
127
|
+
expect(defaultGuidesBundleFor({ slug: 'cafe', name: 'Café Ménü', isPersonal: false }).name).toBe('Café Ménü guides');
|
|
128
|
+
});
|
|
129
|
+
});
|
|
43
130
|
//# sourceMappingURL=bundleSlug.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleSlug.test.js","sourceRoot":"","sources":["../src/bundleSlug.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EA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,iBAAiB,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;aACjF,IAAI,CACR,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QACjF,MAAM,CACJ,sBAAsB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;aAC7E,IAAI,CACR,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,CACJ,sBAAsB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CACpF,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/schemas.d.ts
CHANGED
|
@@ -427,6 +427,49 @@ export declare function parseRuleUnlinkRequest(data: unknown): {
|
|
|
427
427
|
export declare const RuleDeletionsRequestSchema: v.ObjectSchema<{
|
|
428
428
|
readonly deletions: v.SchemaWithPipe<readonly [v.ArraySchema<v.UnknownSchema, undefined>, v.MaxLengthAction<unknown[], 500, undefined>]>;
|
|
429
429
|
}, undefined>;
|
|
430
|
+
/**
|
|
431
|
+
* The sentence a caller gets back when a display name carries a character that
|
|
432
|
+
* cannot be seen. It is written for the person who typed the name, not for the
|
|
433
|
+
* developer reading the schema. This repo's error-message rules put the
|
|
434
|
+
* reader first, keep the blame off them, and ask a refusal to leave them
|
|
435
|
+
* something to do — so the action leads and "control character",
|
|
436
|
+
* which is not a phrase most people can act on, never appears.
|
|
437
|
+
*
|
|
438
|
+
* "often" is doing real work in the second clause. This branch cannot tell a
|
|
439
|
+
* pasted name from a typed one, so it does not claim to; it names
|
|
440
|
+
* where such characters usually come from, which is what makes the advice
|
|
441
|
+
* actionable without overclaiming.
|
|
442
|
+
*/
|
|
443
|
+
export declare const DISPLAY_NAME_CONTROL_CHARACTER_MESSAGE = "Remove the invisible characters from this name \u2014 copying text from another app often brings them along.";
|
|
444
|
+
/**
|
|
445
|
+
* A user-typed display name that is safe to print into a terminal line.
|
|
446
|
+
*
|
|
447
|
+
* Refuses `\p{Cc}` and `\p{Cf}`: the first is where ESC and CR live, and a CR
|
|
448
|
+
* can overwrite the line a user is reading, which in a tool whose job is
|
|
449
|
+
* reporting what reached their agents means the sentence on screen can be made
|
|
450
|
+
* to say something other than what happened. The second is where the bidi
|
|
451
|
+
* overrides U+202A–U+202E live, which reorder a rendered line without changing
|
|
452
|
+
* a byte of it. Same character class as {@link ActionIdSchema} below, so the
|
|
453
|
+
* two fields agree about what a printable string is.
|
|
454
|
+
*
|
|
455
|
+
* **Refuse, never strip.** A user typing a name is present and can be told;
|
|
456
|
+
* rewriting their input silently is what those same rules argue against. The one strip in the codebase — `defaultGuidesBundleFor` in
|
|
457
|
+
* `bundleSlug.ts` — is a *derivation* with no user to report to, which is the
|
|
458
|
+
* exception that fixes the rule rather than a precedent for a second one.
|
|
459
|
+
*
|
|
460
|
+
* **A factory, because the max length is per-field** (64 for a workspace name,
|
|
461
|
+
* 200 for a bundle name) while the character rule is not. Exported rather than
|
|
462
|
+
* inlined so a fourth display-name field meets the rule while reading its
|
|
463
|
+
* neighbours — nothing enforces that it is called.
|
|
464
|
+
*
|
|
465
|
+
* Known cost, taken deliberately: `\p{Cf}` also covers U+200C/U+200D, which
|
|
466
|
+
* Persian, Hindi and Bengali need to render correctly and which join a
|
|
467
|
+
* multi-person emoji into one glyph. Admitting them would mean admitting the
|
|
468
|
+
* bidi overrides beside them, which is the worse failure.
|
|
469
|
+
*/
|
|
470
|
+
export declare function displayNameSchema(maxLength: number): v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>, v.RegexAction<string, "Remove the invisible characters from this name — copying text from another app often brings them along.">]>;
|
|
471
|
+
/** A bundle's display name. Bundles are addressed by slug; this is the label. */
|
|
472
|
+
export declare const BUNDLE_NAME_MAX_LENGTH = 200;
|
|
430
473
|
export declare const BundleSchema: v.ObjectSchema<{
|
|
431
474
|
readonly id: v.StringSchema<undefined>;
|
|
432
475
|
readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, "slug must be lowercase alphanumeric with hyphens">]>;
|
|
@@ -686,7 +729,7 @@ export declare const SubscribeBundleResponseSchema: v.ObjectSchema<{
|
|
|
686
729
|
}, undefined>;
|
|
687
730
|
export declare const CreateBundleRequestSchema: v.ObjectSchema<{
|
|
688
731
|
readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.RegexAction<string, "slug must be lowercase alphanumeric with hyphens">]>;
|
|
689
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string,
|
|
732
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>, v.RegexAction<string, "Remove the invisible characters from this name — copying text from another app often brings them along.">]>;
|
|
690
733
|
}, undefined>;
|
|
691
734
|
export declare const CreateBundleResponseSchema: v.ObjectSchema<{
|
|
692
735
|
readonly bundle: v.ObjectSchema<{
|
|
@@ -731,7 +774,7 @@ export declare const DetachBundleMemberResponseSchema: v.ObjectSchema<{
|
|
|
731
774
|
* repo hands a bundle back — distinct from omitting the field, which leaves it.
|
|
732
775
|
*/
|
|
733
776
|
export declare const UpdateBundleRequestSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
734
|
-
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string,
|
|
777
|
+
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>, v.RegexAction<string, "Remove the invisible characters from this name — copying text from another app often brings them along.">]>, undefined>;
|
|
735
778
|
readonly home: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>, undefined>;
|
|
736
779
|
}, undefined>, v.CheckAction<{
|
|
737
780
|
name?: string | undefined;
|
|
@@ -1000,38 +1043,38 @@ export declare const UpdateContextItemBodySchema: Omit<v.ObjectSchema<{
|
|
|
1000
1043
|
readonly sourceItemIds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.MaxLengthAction<string[], 100, undefined>]>, undefined>;
|
|
1001
1044
|
}, "itemId">;
|
|
1002
1045
|
readonly "~standard": v.StandardProps<{
|
|
1046
|
+
name?: string | undefined;
|
|
1003
1047
|
content?: string | undefined;
|
|
1004
1048
|
expectedVersion?: number | undefined;
|
|
1005
1049
|
projectId?: string | undefined;
|
|
1006
|
-
name?: string | undefined;
|
|
1007
1050
|
sourceItemIds?: string[] | undefined;
|
|
1008
1051
|
}, {
|
|
1052
|
+
name?: string | undefined;
|
|
1009
1053
|
content?: string | undefined;
|
|
1010
1054
|
expectedVersion?: number | undefined;
|
|
1011
1055
|
projectId?: string | undefined;
|
|
1012
|
-
name?: string | undefined;
|
|
1013
1056
|
sourceItemIds?: string[] | undefined;
|
|
1014
1057
|
}>;
|
|
1015
1058
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
1059
|
+
name?: string | undefined;
|
|
1016
1060
|
content?: string | undefined;
|
|
1017
1061
|
expectedVersion?: number | undefined;
|
|
1018
1062
|
projectId?: string | undefined;
|
|
1019
|
-
name?: string | undefined;
|
|
1020
1063
|
sourceItemIds?: string[] | undefined;
|
|
1021
1064
|
}, v.StringIssue | v.MinLengthIssue<string, 1> | v.CheckIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.ArrayIssue | v.ObjectIssue | v.MinValueIssue<number, 1> | v.MaxLengthIssue<string, 200> | v.MaxLengthIssue<string[], 100>>;
|
|
1022
1065
|
readonly "~types"?: {
|
|
1023
1066
|
readonly input: {
|
|
1067
|
+
name?: string | undefined;
|
|
1024
1068
|
content?: string | undefined;
|
|
1025
1069
|
expectedVersion?: number | undefined;
|
|
1026
1070
|
projectId?: string | undefined;
|
|
1027
|
-
name?: string | undefined;
|
|
1028
1071
|
sourceItemIds?: string[] | undefined;
|
|
1029
1072
|
};
|
|
1030
1073
|
readonly output: {
|
|
1074
|
+
name?: string | undefined;
|
|
1031
1075
|
content?: string | undefined;
|
|
1032
1076
|
expectedVersion?: number | undefined;
|
|
1033
1077
|
projectId?: string | undefined;
|
|
1034
|
-
name?: string | undefined;
|
|
1035
1078
|
sourceItemIds?: string[] | undefined;
|
|
1036
1079
|
};
|
|
1037
1080
|
readonly issue: v.StringIssue | v.MinLengthIssue<string, 1> | v.CheckIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.ArrayIssue | v.ObjectIssue | v.MinValueIssue<number, 1> | v.MaxLengthIssue<string, 200> | v.MaxLengthIssue<string[], 100>;
|
|
@@ -2822,10 +2865,10 @@ export declare function parseUpdateContextItemResponse(data: unknown): {
|
|
|
2822
2865
|
updated: boolean;
|
|
2823
2866
|
};
|
|
2824
2867
|
export declare function parseUpdateContextItemBody(data: unknown): {
|
|
2868
|
+
name?: string | undefined;
|
|
2825
2869
|
content?: string | undefined;
|
|
2826
2870
|
expectedVersion?: number | undefined;
|
|
2827
2871
|
projectId?: string | undefined;
|
|
2828
|
-
name?: string | undefined;
|
|
2829
2872
|
sourceItemIds?: string[] | undefined;
|
|
2830
2873
|
};
|
|
2831
2874
|
export declare function parseContextItemResponse(data: unknown): {
|