@bevel-software/platform-shared 0.14.0 → 0.19.0
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/auth/types.d.ts +12 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/git/pr.types.d.ts +75 -11
- package/dist/git/pr.types.d.ts.map +1 -1
- package/dist/git/types.d.ts +75 -2
- package/dist/git/types.d.ts.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/workflow/events.d.ts +39 -4
- package/dist/workflow/events.d.ts.map +1 -1
- package/dist/workflow/events.js.map +1 -1
- package/dist/workflow/interface.d.ts +137 -5
- package/dist/workflow/interface.d.ts.map +1 -1
- package/dist/workflow/types.d.ts +93 -0
- package/dist/workflow/types.d.ts.map +1 -1
- package/dist/workspace/access-verbs.d.ts +83 -0
- package/dist/workspace/access-verbs.d.ts.map +1 -0
- package/dist/workspace/access-verbs.js +110 -0
- package/dist/workspace/access-verbs.js.map +1 -0
- package/dist/workspace/agent-preamble.d.ts +33 -0
- package/dist/workspace/agent-preamble.d.ts.map +1 -0
- package/dist/workspace/agent-preamble.js +45 -0
- package/dist/workspace/agent-preamble.js.map +1 -0
- package/dist/workspace/entry-exists.d.ts +27 -0
- package/dist/workspace/entry-exists.d.ts.map +1 -0
- package/dist/workspace/entry-exists.js +33 -0
- package/dist/workspace/entry-exists.js.map +1 -0
- package/dist/workspace/filename.d.ts +15 -0
- package/dist/workspace/filename.d.ts.map +1 -1
- package/dist/workspace/filename.js +37 -3
- package/dist/workspace/filename.js.map +1 -1
- package/dist/workspace/frontmatter-carriers.d.ts +44 -0
- package/dist/workspace/frontmatter-carriers.d.ts.map +1 -0
- package/dist/workspace/frontmatter-carriers.js +52 -0
- package/dist/workspace/frontmatter-carriers.js.map +1 -0
- package/dist/workspace/frontmatter.d.ts +23 -4
- package/dist/workspace/frontmatter.d.ts.map +1 -1
- package/dist/workspace/frontmatter.js +59 -9
- package/dist/workspace/frontmatter.js.map +1 -1
- package/dist/workspace/kb-layout.d.ts +365 -19
- package/dist/workspace/kb-layout.d.ts.map +1 -1
- package/dist/workspace/kb-layout.js +619 -20
- package/dist/workspace/kb-layout.js.map +1 -1
- package/dist/workspace/placeholder.d.ts +21 -0
- package/dist/workspace/placeholder.d.ts.map +1 -0
- package/dist/workspace/placeholder.js +28 -0
- package/dist/workspace/placeholder.js.map +1 -0
- package/dist/workspace/platform-files.d.ts +105 -0
- package/dist/workspace/platform-files.d.ts.map +1 -0
- package/dist/workspace/platform-files.js +147 -0
- package/dist/workspace/platform-files.js.map +1 -0
- package/dist/workspace/types.d.ts +8 -0
- package/dist/workspace/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/auth/types.ts +12 -0
- package/src/git/pr.types.ts +77 -11
- package/src/git/types.ts +81 -3
- package/src/index.ts +6 -0
- package/src/workflow/events.ts +40 -3
- package/src/workflow/interface.ts +162 -6
- package/src/workflow/types.ts +70 -0
- package/src/workspace/access-verbs.ts +124 -0
- package/src/workspace/agent-preamble.ts +47 -0
- package/src/workspace/entry-exists.ts +36 -0
- package/src/workspace/filename.ts +38 -3
- package/src/workspace/frontmatter-carriers.ts +57 -0
- package/src/workspace/frontmatter.ts +57 -8
- package/src/workspace/kb-layout.ts +660 -24
- package/src/workspace/placeholder.ts +29 -0
- package/src/workspace/platform-files.ts +188 -0
- package/src/workspace/types.ts +8 -0
|
@@ -17,15 +17,24 @@
|
|
|
17
17
|
* the final surface area.
|
|
18
18
|
*/
|
|
19
19
|
import type { AuthUser } from '../auth/types.js';
|
|
20
|
-
import type {
|
|
20
|
+
import type { ChangeRequestApplyFailureKind } from '../git/pr.types.js';
|
|
21
|
+
import type { AcquireLockResult, Branch, BranchSyncOutcome, BranchWorkspaceStatus, CancelChangeRequestResult, Change, ChangeInput, ChangeRequest, ChangeRequestComment, ChangeRequestDetail, ChangeRequestState, ChangedFile, FileApproval, FileLock, FolderChangeRequest, FolderChangeRequestRemoval, MergeBranchOutcome, MergeChangeRequestOutcome, OpenChangeRequestInput, PostChangeRequestCommentInput } from './types.js';
|
|
21
22
|
export interface IWorkflowService {
|
|
23
|
+
/**
|
|
24
|
+
* `freshFetch` bypasses the fetch TTL; `strictFetch` makes a failed fetch
|
|
25
|
+
* throw instead of serving the stale refs — for a caller that uses the
|
|
26
|
+
* list to prove a branch ABSENT (a stale list proves nothing).
|
|
27
|
+
*/
|
|
22
28
|
listBranches(workspaceId: string, opts?: {
|
|
23
29
|
freshFetch?: boolean;
|
|
30
|
+
strictFetch?: boolean;
|
|
24
31
|
}): Promise<Branch[]>;
|
|
25
32
|
/**
|
|
26
33
|
* Create a new unprotected branch. Protected branches cannot be created
|
|
27
34
|
* via the workflow — the protected set is bootstrapped from the KB repo's
|
|
28
|
-
* initial state and never grown at runtime.
|
|
35
|
+
* initial state and never grown at runtime. Holds the branch-lifecycle
|
|
36
|
+
* lock for `name`, so creation is serialised with the branch's deletion
|
|
37
|
+
* and with the retirement of a stale clone under that name.
|
|
29
38
|
*/
|
|
30
39
|
createBranch(workspaceId: string, name: string, fromBase?: string): Promise<Branch>;
|
|
31
40
|
/**
|
|
@@ -70,6 +79,31 @@ export interface IWorkflowService {
|
|
|
70
79
|
* `user` when provided (falls back to the recovery bot).
|
|
71
80
|
*/
|
|
72
81
|
updateFromRemote(workspaceId: string, user?: AuthUser): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* The remote-sync step for ONE branch's clone, driven by a git host's
|
|
84
|
+
* webhook or a pipeline rather than by a person's save. Pulls with the same
|
|
85
|
+
* rebase-and-autostash `updateFromRemote` uses and, when HEAD moved,
|
|
86
|
+
* announces the new tree (`fs-tree-changed`, one `file-changed` per path)
|
|
87
|
+
* so open browsers, agents and the catalogues see it at once.
|
|
88
|
+
*
|
|
89
|
+
* On a conflict it does what `updateFromRemote` does — the divergence goes
|
|
90
|
+
* to the same background recovery ladder (attributed to the recovery bot,
|
|
91
|
+
* since no person triggered the sync) — and, because that is not resolved
|
|
92
|
+
* at request time, reports it as a `conflict` outcome naming the files, so
|
|
93
|
+
* the caller can fail and a person can step in if recovery does not clear
|
|
94
|
+
* it. Never throws for a per-branch failure; every failure is an outcome.
|
|
95
|
+
*/
|
|
96
|
+
syncWorkspaceFromRemote(workspaceId: string): Promise<BranchSyncOutcome>;
|
|
97
|
+
/**
|
|
98
|
+
* Retire the clone of a branch the host has deleted (a `remote-gone`
|
|
99
|
+
* outcome). Runs under the branch-lifecycle lock — the one `createBranch`
|
|
100
|
+
* and `deleteBranch` hold, so no Hexis operation can recreate the branch
|
|
101
|
+
* while the clone is examined and removed — revalidates against origin
|
|
102
|
+
* first, and backs off while a clone of the branch is being bootstrapped.
|
|
103
|
+
* A branch recreated in the meantime therefore keeps its clone. Returns
|
|
104
|
+
* whether the clone was removed.
|
|
105
|
+
*/
|
|
106
|
+
retireRemoteGoneClone(workspaceId: string): Promise<boolean>;
|
|
73
107
|
/**
|
|
74
108
|
* Hard-reset the workspace's checked-out branch to `origin/<branch>` (fetch
|
|
75
109
|
* first), discarding any local divergence. Break-glass primitive for
|
|
@@ -140,6 +174,18 @@ export interface IWorkflowService {
|
|
|
140
174
|
baseline: string | null;
|
|
141
175
|
current: string | null;
|
|
142
176
|
}>;
|
|
177
|
+
/**
|
|
178
|
+
* One file as it stood at a change request's fork point (`sha`, which must
|
|
179
|
+
* lie on the target branch's history) — the "before" side of the request
|
|
180
|
+
* dialog's diff. `null` when the path did not exist there. Access is the
|
|
181
|
+
* caller's to check.
|
|
182
|
+
*/
|
|
183
|
+
fileAtForkPoint(workspaceId: string, baseBranch: string, sha: string, path: string): Promise<string | null>;
|
|
184
|
+
/**
|
|
185
|
+
* A change request's current fork point: the merge base of the freshly
|
|
186
|
+
* fetched target and source branches, or `null` when they share no history.
|
|
187
|
+
*/
|
|
188
|
+
changeRequestForkPoint(workspaceId: string, baseBranch: string, headBranch: string): Promise<string | null>;
|
|
143
189
|
/**
|
|
144
190
|
* Try to acquire an edit lock on `(branch, path)` for the caller. Returns
|
|
145
191
|
* `{ acquired: true, lock }` on success; `{ acquired: false, lock }` if
|
|
@@ -161,9 +207,36 @@ export interface IWorkflowService {
|
|
|
161
207
|
* `releaseLockUntouched`) — `releaseLock` rejects rather than ever enqueue
|
|
162
208
|
* a commit for a hold that was never allowed to write. Internal callers
|
|
163
209
|
* only; never plumbed from a route.
|
|
210
|
+
*
|
|
211
|
+
* Every non-coordination acquire also passes the READ-BEFORE-WRITE gate, on
|
|
212
|
+
* every branch: the caller must be able to read the path (for a new path,
|
|
213
|
+
* where it lands), or the path must start a new folder directly under one
|
|
214
|
+
* of the three roots (knowledge, skills, plugins). Nothing is created,
|
|
215
|
+
* changed or removed where its author cannot see it, whatever write rules
|
|
216
|
+
* say; a refusal is an `AccessDeniedError` whose `access.unreadable` names
|
|
217
|
+
* the place. A write that passed only as a platform-file restore is not
|
|
218
|
+
* asked — that rescue exists for a destination whose rules deny the admin
|
|
219
|
+
* making it.
|
|
220
|
+
*
|
|
221
|
+
* `opts.platformRestore` CLAIMS that this acquire is the destination side of
|
|
222
|
+
* an admin putting a misplaced platform file back (`access.md`, `roles.yaml`,
|
|
223
|
+
* `.bevelignore`, the agent guide), and names the move's `source` — the path the
|
|
224
|
+
* file is coming FROM, in the same spelling as `path`.
|
|
225
|
+
*
|
|
226
|
+
* It is a claim, not an authorisation. The implementation re-asks both
|
|
227
|
+
* halves of it: that source→path is a restore at all (a misplaced copy
|
|
228
|
+
* going back under its own name, never the root's own copy coming out —
|
|
229
|
+
* `isPlatformRestoreShape`), and that the access module
|
|
230
|
+
* (`canRestorePlatformFile`) lets this caller land this exact path. Only
|
|
231
|
+
* both yeses let the acquire past the write gate, so a caller that omits or
|
|
232
|
+
* fakes the source gains nothing: the gate never takes the route's word for
|
|
233
|
+
* which move this is.
|
|
164
234
|
*/
|
|
165
235
|
acquireLock(workspaceId: string, branch: string, path: string, user: AuthUser, opts?: {
|
|
166
236
|
coordination?: boolean;
|
|
237
|
+
platformRestore?: {
|
|
238
|
+
source: string;
|
|
239
|
+
};
|
|
167
240
|
}): Promise<AcquireLockResult>;
|
|
168
241
|
/** Heartbeat to keep an acquired lock alive past its current TTL. */
|
|
169
242
|
heartbeatLock(workspaceId: string, branch: string, path: string, user: AuthUser): Promise<FileLock>;
|
|
@@ -276,9 +349,12 @@ export interface IWorkflowService {
|
|
|
276
349
|
*/
|
|
277
350
|
openChangeRequest(workspaceId: string, user: AuthUser, input: OpenChangeRequestInput): Promise<ChangeRequestDetail>;
|
|
278
351
|
/**
|
|
279
|
-
* Re-run `targetBranch → sourceBranch` merge on an existing change request
|
|
280
|
-
*
|
|
281
|
-
*
|
|
352
|
+
* Re-run `targetBranch → sourceBranch` merge on an existing change request
|
|
353
|
+
* and push it — the request dialog's Update, offered when the target has
|
|
354
|
+
* advanced since the request was opened. Only the request's author or
|
|
355
|
+
* someone who may apply it (`viewerCanUpdate`) may run it (403 otherwise).
|
|
356
|
+
* A conflicting merge is aborted, leaving the branch exactly as it was, and
|
|
357
|
+
* surfaces as `ChangeRequestConflictsError` (409).
|
|
282
358
|
*/
|
|
283
359
|
updateFromTarget(workspaceId: string, user: AuthUser, number: number): Promise<ChangeRequestDetail>;
|
|
284
360
|
listComments(number: number): Promise<ChangeRequestComment[]>;
|
|
@@ -304,6 +380,20 @@ export interface IWorkflowService {
|
|
|
304
380
|
* Returns true when this call closed it.
|
|
305
381
|
*/
|
|
306
382
|
closeEmptyChangeRequest(number: number, user: AuthUser): Promise<boolean>;
|
|
383
|
+
/**
|
|
384
|
+
* The open change requests proposing files under a KB-repo-relative
|
|
385
|
+
* folder, each with whether the caller may take those files out of it
|
|
386
|
+
* (their own request, they are an admin, or they may write every file it
|
|
387
|
+
* proposes under the folder).
|
|
388
|
+
*/
|
|
389
|
+
changeRequestsUnderFolder(folder: string, user: AuthUser): Promise<FolderChangeRequest[]>;
|
|
390
|
+
/**
|
|
391
|
+
* Take every file under the folder out of every open change request
|
|
392
|
+
* proposing one; a request left empty is withdrawn. All or nothing: refused
|
|
393
|
+
* (403), with nothing touched, when the caller may not act on even one of
|
|
394
|
+
* them.
|
|
395
|
+
*/
|
|
396
|
+
removeFolderFromChangeRequests(folder: string, user: AuthUser): Promise<FolderChangeRequestRemoval[]>;
|
|
307
397
|
/**
|
|
308
398
|
* Close every open change request either of whose branches no longer exists
|
|
309
399
|
* — source or target, since a proposal needs both ends. Such a request
|
|
@@ -342,5 +432,47 @@ export interface IWorkflowService {
|
|
|
342
432
|
mergeChangeRequest(number: number, user: AuthUser, headSha: string, approvals: FileApproval[], state: ChangeRequestState, title: string, baseBranch: string, workspaceId: string, opts?: {
|
|
343
433
|
bypass?: boolean;
|
|
344
434
|
}): Promise<MergeChangeRequestOutcome>;
|
|
435
|
+
/** Start an apply attempt on a request; the token scopes `recordApplyFailure`. */
|
|
436
|
+
beginApplyAttempt(number: number): number;
|
|
437
|
+
/** End an attempt `beginApplyAttempt` started, whatever its outcome. */
|
|
438
|
+
endApplyAttempt(number: number, attempt: number): void;
|
|
439
|
+
/**
|
|
440
|
+
* Persist why an apply did not land on the (still open) request, and
|
|
441
|
+
* announce `change-request-apply-failed` to every session so the author and
|
|
442
|
+
* other viewers re-read it — not only the user who clicked. Resolves false,
|
|
443
|
+
* recording and announcing nothing, when `attempt` is no longer the latest
|
|
444
|
+
* or the request is no longer open.
|
|
445
|
+
*/
|
|
446
|
+
recordApplyFailure(number: number, failure: {
|
|
447
|
+
reason: string;
|
|
448
|
+
kind: ChangeRequestApplyFailureKind;
|
|
449
|
+
at?: Date;
|
|
450
|
+
}, user: AuthUser, attempt: number): Promise<boolean>;
|
|
451
|
+
/**
|
|
452
|
+
* Merge `sourceBranch` into `targetBranch` directly, authored as `user`,
|
|
453
|
+
* and publish the target. The agent path for merging branches — it never
|
|
454
|
+
* lands a change request:
|
|
455
|
+
*
|
|
456
|
+
* - refused (`OpenChangeRequestBlocksMergeError`, naming the request) when
|
|
457
|
+
* a change request from `sourceBranch` into `targetBranch` is open; a
|
|
458
|
+
* person merges that one in the app. The reverse direction — the target
|
|
459
|
+
* into the source, the sync that keeps a draft current — is allowed.
|
|
460
|
+
* - refused (`WorkflowDomainError`, `kind: 'protected-merge-target'`,
|
|
461
|
+
* status 403, listing the denied paths) when `targetBranch` is protected
|
|
462
|
+
* and `user` could not commit every file the merge changes directly to
|
|
463
|
+
* it. Decided against the target commit the merge is built on, not a
|
|
464
|
+
* workspace `HEAD` that may be behind it.
|
|
465
|
+
* - refused (`WorkflowDomainError`, `kind: 'protected-merge-changes-roles'`,
|
|
466
|
+
* status 403) when `targetBranch` is protected and the merge would
|
|
467
|
+
* change its `roles.yaml` — whoever the caller is. Roles never change
|
|
468
|
+
* through a merge; a change request's merge restores the target's copy
|
|
469
|
+
* first, and this path refuses instead. Roles are changed in the app.
|
|
470
|
+
* - refused (`WorkflowDomainError`, `kind: 'merge-target-busy'`, status
|
|
471
|
+
* 409) when `targetBranch`'s workspace still holds unshared edits: the
|
|
472
|
+
* merge resets it to the published tip, which would discard them.
|
|
473
|
+
*
|
|
474
|
+
* Conflicts write nothing and come back as `conflicts-need-resolution`.
|
|
475
|
+
*/
|
|
476
|
+
mergeBranch(user: AuthUser, sourceBranch: string, targetBranch: string): Promise<MergeBranchOutcome>;
|
|
345
477
|
}
|
|
346
478
|
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/workflow/interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,iBAAiB,EACjB,MAAM,EACN,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,EACN,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,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,EAAE,YAAY,EAAE,EACzB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAC1B,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC,kFAAkF;IAClF,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1C,wEAAwE;IACxE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvD;;;;;;OAMG;IACH,kBAAkB,CAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,6BAA6B,CAAC;QAAC,EAAE,CAAC,EAAE,IAAI,CAAA;KAAE,EAC3E,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACtG"}
|
package/dist/workflow/types.d.ts
CHANGED
|
@@ -104,6 +104,43 @@ export type MergeChangeRequestResult = MergePrResult;
|
|
|
104
104
|
export type CancelChangeRequestResult = CancelPrResult;
|
|
105
105
|
export type ChangeRequestComment = PrReviewComment;
|
|
106
106
|
export type PostChangeRequestCommentInput = PostPrCommentInput;
|
|
107
|
+
/**
|
|
108
|
+
* One open change request proposing files under a folder, as a folder delete
|
|
109
|
+
* lists it. `mayRemove`: the caller may take those files out of it (their own,
|
|
110
|
+
* they are an admin, or they may write every file it proposes under the
|
|
111
|
+
* folder); a refusal always says why.
|
|
112
|
+
*/
|
|
113
|
+
export type FolderChangeRequest = {
|
|
114
|
+
number: number;
|
|
115
|
+
title: string;
|
|
116
|
+
authorName: string | null;
|
|
117
|
+
/** The caller authored it. */
|
|
118
|
+
mine: boolean;
|
|
119
|
+
/** KB-repo-relative paths it proposes under the folder. */
|
|
120
|
+
paths: string[];
|
|
121
|
+
} & ({
|
|
122
|
+
mayRemove: true;
|
|
123
|
+
} | {
|
|
124
|
+
mayRemove: false;
|
|
125
|
+
reason: string;
|
|
126
|
+
});
|
|
127
|
+
/** What removing a folder's files did to one change request. */
|
|
128
|
+
export interface FolderChangeRequestRemoval {
|
|
129
|
+
number: number;
|
|
130
|
+
removedPaths: string[];
|
|
131
|
+
/** The request proposed nothing else, so it was withdrawn. */
|
|
132
|
+
withdrawn: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Files under the folder it still proposes: added while the removal ran,
|
|
135
|
+
* so never judged, and left alone.
|
|
136
|
+
*/
|
|
137
|
+
stillProposed: string[];
|
|
138
|
+
/**
|
|
139
|
+
* It proposes nothing now but was kept open, because a save to its branch
|
|
140
|
+
* was still landing — withdrawing would have deleted that save.
|
|
141
|
+
*/
|
|
142
|
+
keptForSaves: boolean;
|
|
143
|
+
}
|
|
107
144
|
/**
|
|
108
145
|
* Input for opening a new change request. The workflow auto-merges
|
|
109
146
|
* `targetBranch` into `sourceBranch` as part of opening, so callers don't
|
|
@@ -137,4 +174,60 @@ export type MergeChangeRequestOutcome = {
|
|
|
137
174
|
kind: 'conflicts-need-resolution';
|
|
138
175
|
conflictedPaths: string[];
|
|
139
176
|
};
|
|
177
|
+
/**
|
|
178
|
+
* What a direct branch-to-branch merge (`mergeBranch`) did: landed as `sha`
|
|
179
|
+
* on the target (the target's own tip when it already contained the source),
|
|
180
|
+
* or stopped on conflicts, nothing written.
|
|
181
|
+
*/
|
|
182
|
+
export type MergeBranchOutcome = {
|
|
183
|
+
kind: 'merged';
|
|
184
|
+
sha: string;
|
|
185
|
+
} | {
|
|
186
|
+
kind: 'conflicts-need-resolution';
|
|
187
|
+
conflictedPaths: string[];
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* What a remote sync did to one branch's clone. One entry per branch in the
|
|
191
|
+
* `POST /api/sync` response, so a pipeline can read exactly which branch
|
|
192
|
+
* moved, which was already current, and which needs a person.
|
|
193
|
+
*
|
|
194
|
+
* - `updated` — the clone moved from `from` (null when it had no commits
|
|
195
|
+
* yet) to `to`.
|
|
196
|
+
* - `up-to-date` — origin had nothing new; `to` is the unchanged HEAD.
|
|
197
|
+
* - `not-cloned` — Hexis has no clone of this branch, so there is nothing
|
|
198
|
+
* to refresh (the first visit clones it fresh).
|
|
199
|
+
* - `remote-gone` — the branch no longer exists on the host; the stale clone
|
|
200
|
+
* is removed. Not a failure: a deleted branch has nothing
|
|
201
|
+
* to sync.
|
|
202
|
+
* - `conflict` — Hexis-side commits contradict what landed on the host.
|
|
203
|
+
* The clone is untouched; `error` is the message to show
|
|
204
|
+
* and `conflictedPaths` the files a person must reconcile.
|
|
205
|
+
* - `error` — the pull failed for another reason (origin unreachable,
|
|
206
|
+
* credential refused); `error` is the sanitised message.
|
|
207
|
+
*/
|
|
208
|
+
export type BranchSyncOutcome = {
|
|
209
|
+
branch: string;
|
|
210
|
+
outcome: 'updated';
|
|
211
|
+
from: string | null;
|
|
212
|
+
to: string;
|
|
213
|
+
} | {
|
|
214
|
+
branch: string;
|
|
215
|
+
outcome: 'up-to-date';
|
|
216
|
+
to: string;
|
|
217
|
+
} | {
|
|
218
|
+
branch: string;
|
|
219
|
+
outcome: 'not-cloned';
|
|
220
|
+
} | {
|
|
221
|
+
branch: string;
|
|
222
|
+
outcome: 'remote-gone';
|
|
223
|
+
} | {
|
|
224
|
+
branch: string;
|
|
225
|
+
outcome: 'conflict';
|
|
226
|
+
conflictedPaths: string[];
|
|
227
|
+
error: string;
|
|
228
|
+
} | {
|
|
229
|
+
branch: string;
|
|
230
|
+
outcome: 'error';
|
|
231
|
+
error: string;
|
|
232
|
+
};
|
|
140
233
|
//# sourceMappingURL=types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AAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACvE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GACzC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjF;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The access verbs and the ONE dependency graph between them.
|
|
3
|
+
*
|
|
4
|
+
* Shared so that everything that folds verbs — the resolver in core-backend,
|
|
5
|
+
* the eligible lists it serves, and the share dialog in core-frontend that
|
|
6
|
+
* renders and edits them — reads the same table. A second fold written out by
|
|
7
|
+
* hand somewhere else is how the sheet comes to show "Owner" for someone the
|
|
8
|
+
* resolver refuses, or writes a `read:` line under an `owner:` it just granted.
|
|
9
|
+
*
|
|
10
|
+
* `read` controls who may VIEW a path. It is default-deny: a path with no
|
|
11
|
+
* effective grant of any verb is not readable. `write` is editing (and, with
|
|
12
|
+
* it, approval rights), `download` is saving a copy, `owner` is the contact
|
|
13
|
+
* point for the node and the right to manage its access.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Verbs an `access.md` frontmatter can grant, each a list of principals
|
|
17
|
+
* optionally prefixed with `deny `. `AccessFile.entries` in the backend is
|
|
18
|
+
* statically keyed on this union; keep `Verb` and `KNOWN_VERBS` in lockstep.
|
|
19
|
+
*/
|
|
20
|
+
export declare const KNOWN_VERBS: readonly ["read", "write", "download", "owner"];
|
|
21
|
+
export type Verb = (typeof KNOWN_VERBS)[number];
|
|
22
|
+
/**
|
|
23
|
+
* THE DEPENDENCY GRAPH — what holding each verb presupposes, declared once.
|
|
24
|
+
* `owner` presupposes `write` and `download`; `write` and `download` each
|
|
25
|
+
* presuppose `read`; `read` presupposes nothing. Everything about how verbs
|
|
26
|
+
* fold into one another is DERIVED from this table, in both directions:
|
|
27
|
+
*
|
|
28
|
+
* - a GRANT confers, downwards, every verb the granted one presupposes
|
|
29
|
+
* (`sourceVerbsFor`, `effectiveVerbs`): an owner may edit, save and open;
|
|
30
|
+
* an editor may open; someone trusted with a copy may open it;
|
|
31
|
+
* - a DENIAL strips, upwards, every verb that presupposes the denied one
|
|
32
|
+
* (`requiredVerbsFor`): nobody owns what they may not edit, and nobody
|
|
33
|
+
* edits or saves what they may not open.
|
|
34
|
+
*
|
|
35
|
+
* Neither converse is implied: a `deny write` says nothing about `read`, and a
|
|
36
|
+
* `read` grant confers no `write`. `write` and `download` are independent of
|
|
37
|
+
* each other. Add a verb, or change what one presupposes, HERE and nowhere
|
|
38
|
+
* else; every list and fold below follows.
|
|
39
|
+
*/
|
|
40
|
+
export declare const VERB_REQUIRES: Readonly<Record<Verb, readonly Verb[]>>;
|
|
41
|
+
/**
|
|
42
|
+
* Verbs whose GRANT confers `verb`, target verb first: `verb` itself, then
|
|
43
|
+
* every verb that presupposes it, in `KNOWN_VERBS` order.
|
|
44
|
+
*/
|
|
45
|
+
export declare function sourceVerbsFor(verb: Verb): Verb[];
|
|
46
|
+
/**
|
|
47
|
+
* Verbs whose DENIAL strips `verb`, target verb first: `verb` itself, then
|
|
48
|
+
* every verb it presupposes, in `KNOWN_VERBS` order.
|
|
49
|
+
*/
|
|
50
|
+
export declare function requiredVerbsFor(verb: Verb): Verb[];
|
|
51
|
+
/**
|
|
52
|
+
* The verbs in the order a change to a principal's set has to be APPLIED:
|
|
53
|
+
* broadest first, so every verb comes before the verbs it presupposes (ties in
|
|
54
|
+
* `KNOWN_VERBS` order). Lowering must start at the top — denying `write` while
|
|
55
|
+
* an `owner:` grant still stands in the same file is refused as ineffective,
|
|
56
|
+
* since owner confers write; stripping owner first removes what was conferring
|
|
57
|
+
* it. Raising reads the same order for the opposite reason: granting `owner`
|
|
58
|
+
* first satisfies the rest in one line.
|
|
59
|
+
*/
|
|
60
|
+
export declare const VERBS_BROADEST_FIRST: readonly Verb[];
|
|
61
|
+
/** One flag per verb: what a principal holds, or what a form has ticked. */
|
|
62
|
+
export type VerbSet = Record<Verb, boolean>;
|
|
63
|
+
/** A partial set — flags left out read as not held. */
|
|
64
|
+
export type VerbFlags = Partial<Record<Verb, boolean>>;
|
|
65
|
+
/**
|
|
66
|
+
* The grant fold, as a whole set: what a principal EFFECTIVELY holds given the
|
|
67
|
+
* verbs they are granted. Each verb is held when it, or any verb that
|
|
68
|
+
* presupposes it, is in `held`. Idempotent on an already-folded set.
|
|
69
|
+
*/
|
|
70
|
+
export declare function effectiveVerbs(held: VerbFlags): VerbSet;
|
|
71
|
+
/**
|
|
72
|
+
* True when some OTHER verb in `held` confers `verb` — it is implied, not
|
|
73
|
+
* chosen, which is what a form renders as checked-and-disabled.
|
|
74
|
+
*/
|
|
75
|
+
export declare function conferredByOthers(held: VerbFlags, verb: Verb): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The fewest grant lines that produce `held`: every held verb that no other
|
|
78
|
+
* held verb confers, broadest first. `{ owner }` is one line; `{ write, read,
|
|
79
|
+
* download }` is `write` and `download` (read rides on either); `{ read,
|
|
80
|
+
* download }` is `download` alone. A flag left out is not granted.
|
|
81
|
+
*/
|
|
82
|
+
export declare function minimalGrantVerbs(held: VerbFlags): Verb[];
|
|
83
|
+
//# sourceMappingURL=access-verbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-verbs.d.ts","sourceRoot":"","sources":["../../src/workspace/access-verbs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW,iDAAkD,CAAC;AAC3E,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,CAKjE,CAAC;AAcF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAEjD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAGnD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,IAAI,EAG/C,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5C,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAIvD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,EAAE,CAEzD"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The access verbs and the ONE dependency graph between them.
|
|
3
|
+
*
|
|
4
|
+
* Shared so that everything that folds verbs — the resolver in core-backend,
|
|
5
|
+
* the eligible lists it serves, and the share dialog in core-frontend that
|
|
6
|
+
* renders and edits them — reads the same table. A second fold written out by
|
|
7
|
+
* hand somewhere else is how the sheet comes to show "Owner" for someone the
|
|
8
|
+
* resolver refuses, or writes a `read:` line under an `owner:` it just granted.
|
|
9
|
+
*
|
|
10
|
+
* `read` controls who may VIEW a path. It is default-deny: a path with no
|
|
11
|
+
* effective grant of any verb is not readable. `write` is editing (and, with
|
|
12
|
+
* it, approval rights), `download` is saving a copy, `owner` is the contact
|
|
13
|
+
* point for the node and the right to manage its access.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Verbs an `access.md` frontmatter can grant, each a list of principals
|
|
17
|
+
* optionally prefixed with `deny `. `AccessFile.entries` in the backend is
|
|
18
|
+
* statically keyed on this union; keep `Verb` and `KNOWN_VERBS` in lockstep.
|
|
19
|
+
*/
|
|
20
|
+
export const KNOWN_VERBS = ['read', 'write', 'download', 'owner'];
|
|
21
|
+
/**
|
|
22
|
+
* THE DEPENDENCY GRAPH — what holding each verb presupposes, declared once.
|
|
23
|
+
* `owner` presupposes `write` and `download`; `write` and `download` each
|
|
24
|
+
* presuppose `read`; `read` presupposes nothing. Everything about how verbs
|
|
25
|
+
* fold into one another is DERIVED from this table, in both directions:
|
|
26
|
+
*
|
|
27
|
+
* - a GRANT confers, downwards, every verb the granted one presupposes
|
|
28
|
+
* (`sourceVerbsFor`, `effectiveVerbs`): an owner may edit, save and open;
|
|
29
|
+
* an editor may open; someone trusted with a copy may open it;
|
|
30
|
+
* - a DENIAL strips, upwards, every verb that presupposes the denied one
|
|
31
|
+
* (`requiredVerbsFor`): nobody owns what they may not edit, and nobody
|
|
32
|
+
* edits or saves what they may not open.
|
|
33
|
+
*
|
|
34
|
+
* Neither converse is implied: a `deny write` says nothing about `read`, and a
|
|
35
|
+
* `read` grant confers no `write`. `write` and `download` are independent of
|
|
36
|
+
* each other. Add a verb, or change what one presupposes, HERE and nowhere
|
|
37
|
+
* else; every list and fold below follows.
|
|
38
|
+
*/
|
|
39
|
+
export const VERB_REQUIRES = {
|
|
40
|
+
read: [],
|
|
41
|
+
write: ['read'],
|
|
42
|
+
download: ['read'],
|
|
43
|
+
owner: ['write', 'download'],
|
|
44
|
+
};
|
|
45
|
+
/** `verb` and everything it presupposes, transitively. */
|
|
46
|
+
function presupposedBy(verb) {
|
|
47
|
+
const out = new Set();
|
|
48
|
+
const visit = (v) => {
|
|
49
|
+
if (out.has(v))
|
|
50
|
+
return;
|
|
51
|
+
out.add(v);
|
|
52
|
+
for (const dep of VERB_REQUIRES[v])
|
|
53
|
+
visit(dep);
|
|
54
|
+
};
|
|
55
|
+
visit(verb);
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Verbs whose GRANT confers `verb`, target verb first: `verb` itself, then
|
|
60
|
+
* every verb that presupposes it, in `KNOWN_VERBS` order.
|
|
61
|
+
*/
|
|
62
|
+
export function sourceVerbsFor(verb) {
|
|
63
|
+
return [verb, ...KNOWN_VERBS.filter((v) => v !== verb && presupposedBy(v).has(verb))];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Verbs whose DENIAL strips `verb`, target verb first: `verb` itself, then
|
|
67
|
+
* every verb it presupposes, in `KNOWN_VERBS` order.
|
|
68
|
+
*/
|
|
69
|
+
export function requiredVerbsFor(verb) {
|
|
70
|
+
const needs = presupposedBy(verb);
|
|
71
|
+
return [verb, ...KNOWN_VERBS.filter((v) => v !== verb && needs.has(v))];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The verbs in the order a change to a principal's set has to be APPLIED:
|
|
75
|
+
* broadest first, so every verb comes before the verbs it presupposes (ties in
|
|
76
|
+
* `KNOWN_VERBS` order). Lowering must start at the top — denying `write` while
|
|
77
|
+
* an `owner:` grant still stands in the same file is refused as ineffective,
|
|
78
|
+
* since owner confers write; stripping owner first removes what was conferring
|
|
79
|
+
* it. Raising reads the same order for the opposite reason: granting `owner`
|
|
80
|
+
* first satisfies the rest in one line.
|
|
81
|
+
*/
|
|
82
|
+
export const VERBS_BROADEST_FIRST = [...KNOWN_VERBS].sort((a, b) => presupposedBy(b).size - presupposedBy(a).size || KNOWN_VERBS.indexOf(a) - KNOWN_VERBS.indexOf(b));
|
|
83
|
+
/**
|
|
84
|
+
* The grant fold, as a whole set: what a principal EFFECTIVELY holds given the
|
|
85
|
+
* verbs they are granted. Each verb is held when it, or any verb that
|
|
86
|
+
* presupposes it, is in `held`. Idempotent on an already-folded set.
|
|
87
|
+
*/
|
|
88
|
+
export function effectiveVerbs(held) {
|
|
89
|
+
const out = {};
|
|
90
|
+
for (const verb of KNOWN_VERBS)
|
|
91
|
+
out[verb] = sourceVerbsFor(verb).some((w) => held[w] === true);
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* True when some OTHER verb in `held` confers `verb` — it is implied, not
|
|
96
|
+
* chosen, which is what a form renders as checked-and-disabled.
|
|
97
|
+
*/
|
|
98
|
+
export function conferredByOthers(held, verb) {
|
|
99
|
+
return sourceVerbsFor(verb).some((w) => w !== verb && held[w] === true);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The fewest grant lines that produce `held`: every held verb that no other
|
|
103
|
+
* held verb confers, broadest first. `{ owner }` is one line; `{ write, read,
|
|
104
|
+
* download }` is `write` and `download` (read rides on either); `{ read,
|
|
105
|
+
* download }` is `download` alone. A flag left out is not granted.
|
|
106
|
+
*/
|
|
107
|
+
export function minimalGrantVerbs(held) {
|
|
108
|
+
return VERBS_BROADEST_FIRST.filter((verb) => held[verb] === true && !conferredByOthers(held, verb));
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=access-verbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-verbs.js","sourceRoot":"","sources":["../../src/workspace/access-verbs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH,MAA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|
3
|
+
* agree on: the file it lives in, the caps it is cut at, and what counts as a
|
|
4
|
+
* private comment inside it.
|
|
5
|
+
*
|
|
6
|
+
* These lived in the backend composer and were mirrored by hand in the
|
|
7
|
+
* frontend editor, whose own comment said so. The two are not free to differ:
|
|
8
|
+
* the editor decides what an admin is shown and what it writes back, the
|
|
9
|
+
* composer decides what agents receive, and a drift between them shows the
|
|
10
|
+
* admin one description while agents get another.
|
|
11
|
+
*
|
|
12
|
+
* Pure: no IO, no clock, no platform assumptions.
|
|
13
|
+
*/
|
|
14
|
+
/** The repository-root file an admin edits. */
|
|
15
|
+
export declare const PREAMBLE_FILE = "mcp-description.md";
|
|
16
|
+
/** UTF-16 units of preamble sent on the handshake before the marker replaces the rest. */
|
|
17
|
+
export declare const PREAMBLE_CAP = 6000;
|
|
18
|
+
/** UTF-16 units of the whole tool prefix (fixed line included). */
|
|
19
|
+
export declare const TOOL_PREFIX_CAP = 300;
|
|
20
|
+
/**
|
|
21
|
+
* Remove every `<!-- … -->` block.
|
|
22
|
+
*
|
|
23
|
+
* A `<!--` that is never closed takes the rest of the text with it and is
|
|
24
|
+
* reported, so a caller can warn: that is the fail-closed half of the rule,
|
|
25
|
+
* and it is why an admin's private note cannot leak through the likeliest
|
|
26
|
+
* editing slip. The editor strips the same blocks to decide what to show, and
|
|
27
|
+
* closes an unterminated one when it writes back.
|
|
28
|
+
*/
|
|
29
|
+
export declare function stripHtmlComments(text: string): {
|
|
30
|
+
text: string;
|
|
31
|
+
unterminated: boolean;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=agent-preamble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-preamble.d.ts","sourceRoot":"","sources":["../../src/workspace/agent-preamble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+CAA+C;AAC/C,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAElD,0FAA0F;AAC1F,eAAO,MAAM,YAAY,OAAQ,CAAC;AAElC,mEAAmE;AACnE,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAcvF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rules about the deployment preamble's TEXT that both sides need to
|
|
3
|
+
* agree on: the file it lives in, the caps it is cut at, and what counts as a
|
|
4
|
+
* private comment inside it.
|
|
5
|
+
*
|
|
6
|
+
* These lived in the backend composer and were mirrored by hand in the
|
|
7
|
+
* frontend editor, whose own comment said so. The two are not free to differ:
|
|
8
|
+
* the editor decides what an admin is shown and what it writes back, the
|
|
9
|
+
* composer decides what agents receive, and a drift between them shows the
|
|
10
|
+
* admin one description while agents get another.
|
|
11
|
+
*
|
|
12
|
+
* Pure: no IO, no clock, no platform assumptions.
|
|
13
|
+
*/
|
|
14
|
+
/** The repository-root file an admin edits. */
|
|
15
|
+
export const PREAMBLE_FILE = 'mcp-description.md';
|
|
16
|
+
/** UTF-16 units of preamble sent on the handshake before the marker replaces the rest. */
|
|
17
|
+
export const PREAMBLE_CAP = 6_000;
|
|
18
|
+
/** UTF-16 units of the whole tool prefix (fixed line included). */
|
|
19
|
+
export const TOOL_PREFIX_CAP = 300;
|
|
20
|
+
/**
|
|
21
|
+
* Remove every `<!-- … -->` block.
|
|
22
|
+
*
|
|
23
|
+
* A `<!--` that is never closed takes the rest of the text with it and is
|
|
24
|
+
* reported, so a caller can warn: that is the fail-closed half of the rule,
|
|
25
|
+
* and it is why an admin's private note cannot leak through the likeliest
|
|
26
|
+
* editing slip. The editor strips the same blocks to decide what to show, and
|
|
27
|
+
* closes an unterminated one when it writes back.
|
|
28
|
+
*/
|
|
29
|
+
export function stripHtmlComments(text) {
|
|
30
|
+
let out = '';
|
|
31
|
+
let from = 0;
|
|
32
|
+
for (;;) {
|
|
33
|
+
const open = text.indexOf('<!--', from);
|
|
34
|
+
if (open === -1) {
|
|
35
|
+
out += text.slice(from);
|
|
36
|
+
return { text: out, unterminated: false };
|
|
37
|
+
}
|
|
38
|
+
out += text.slice(from, open);
|
|
39
|
+
const close = text.indexOf('-->', open + 4);
|
|
40
|
+
if (close === -1)
|
|
41
|
+
return { text: out, unterminated: true };
|
|
42
|
+
from = close + 3;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=agent-preamble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-preamble.js","sourceRoot":"","sources":["../../src/workspace/agent-preamble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAElD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;AAElC,mEAAmE;AACnE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,SAAS,CAAC;QACR,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC;YAChB,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACxB,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;QAC5C,CAAC;QACD,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;QAC3D,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;AACH,CAAC"}
|