@namzu/sdk 45.0.0 → 46.0.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/CHANGELOG.md +166 -0
- package/dist/authorization/gate.d.ts +5 -2
- package/dist/authorization/gate.d.ts.map +1 -1
- package/dist/authorization/gate.js +35 -4
- package/dist/authorization/gate.js.map +1 -1
- package/dist/authorization/rules.d.ts.map +1 -1
- package/dist/authorization/rules.js +56 -6
- package/dist/authorization/rules.js.map +1 -1
- package/dist/authorization/shell-lexer.d.ts +38 -0
- package/dist/authorization/shell-lexer.d.ts.map +1 -1
- package/dist/authorization/shell-lexer.js +88 -57
- package/dist/authorization/shell-lexer.js.map +1 -1
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +2 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +1 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/directory/types.d.ts +2 -0
- package/dist/directory/types.d.ts.map +1 -1
- package/dist/directory/types.js.map +1 -1
- package/dist/manager/resident/outbox.d.ts +4 -4
- package/dist/pricing/catalogue.generated.d.ts.map +1 -1
- package/dist/pricing/catalogue.generated.js +28 -4
- package/dist/pricing/catalogue.generated.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +1 -0
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/public-runtime.d.ts +6 -3
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +14 -2
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +7 -2
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +15 -2
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +8 -2
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/tool/callable.d.ts +22 -0
- package/dist/registry/tool/callable.d.ts.map +1 -0
- package/dist/registry/tool/callable.js +29 -0
- package/dist/registry/tool/callable.js.map +1 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +8 -1
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/runtime/query/declined.d.ts +12 -0
- package/dist/runtime/query/declined.d.ts.map +1 -0
- package/dist/runtime/query/declined.js +12 -0
- package/dist/runtime/query/declined.js.map +1 -0
- package/dist/runtime/query/executor/tool-call-admission.d.ts +37 -11
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +38 -12
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +7 -3
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +32 -7
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +1 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +7 -0
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +6 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/handoff.d.ts +22 -0
- package/dist/runtime/query/iteration/phases/handoff.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/handoff.js +65 -0
- package/dist/runtime/query/iteration/phases/handoff.js.map +1 -0
- package/dist/runtime/query/iteration/phases/index.d.ts +1 -0
- package/dist/runtime/query/iteration/phases/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/index.js +1 -0
- package/dist/runtime/query/iteration/phases/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +8 -3
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +3 -2
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +43 -0
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +63 -19
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/schedules/cron.d.ts +21 -0
- package/dist/schedules/cron.d.ts.map +1 -0
- package/dist/schedules/cron.js +167 -0
- package/dist/schedules/cron.js.map +1 -0
- package/dist/schedules/describe.d.ts +14 -0
- package/dist/schedules/describe.d.ts.map +1 -0
- package/dist/schedules/describe.js +133 -0
- package/dist/schedules/describe.js.map +1 -0
- package/dist/schedules/errors.d.ts +11 -0
- package/dist/schedules/errors.d.ts.map +1 -0
- package/dist/schedules/errors.js +15 -0
- package/dist/schedules/errors.js.map +1 -0
- package/dist/schedules/evaluate.d.ts +35 -0
- package/dist/schedules/evaluate.d.ts.map +1 -0
- package/dist/schedules/evaluate.js +158 -0
- package/dist/schedules/evaluate.js.map +1 -0
- package/dist/schedules/index.d.ts +11 -0
- package/dist/schedules/index.d.ts.map +1 -0
- package/dist/schedules/index.js +8 -0
- package/dist/schedules/index.js.map +1 -0
- package/dist/schedules/next-fire.d.ts +50 -0
- package/dist/schedules/next-fire.d.ts.map +1 -0
- package/dist/schedules/next-fire.js +250 -0
- package/dist/schedules/next-fire.js.map +1 -0
- package/dist/schedules/spec.d.ts +30 -0
- package/dist/schedules/spec.d.ts.map +1 -0
- package/dist/schedules/spec.js +169 -0
- package/dist/schedules/spec.js.map +1 -0
- package/dist/schedules/types.d.ts +144 -0
- package/dist/schedules/types.d.ts.map +1 -0
- package/dist/schedules/types.js +11 -0
- package/dist/schedules/types.js.map +1 -0
- package/dist/schedules/tz.d.ts +44 -0
- package/dist/schedules/tz.d.ts.map +1 -0
- package/dist/schedules/tz.js +141 -0
- package/dist/schedules/tz.js.map +1 -0
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/loader.d.ts +16 -3
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +48 -4
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/registry.d.ts +6 -0
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +1 -0
- package/dist/skills/registry.js.map +1 -1
- package/dist/tools/builtins/browser-url.d.ts +83 -0
- package/dist/tools/builtins/browser-url.d.ts.map +1 -0
- package/dist/tools/builtins/browser-url.js +240 -0
- package/dist/tools/builtins/browser-url.js.map +1 -0
- package/dist/tools/builtins/browser.d.ts +367 -0
- package/dist/tools/builtins/browser.d.ts.map +1 -0
- package/dist/tools/builtins/browser.js +704 -0
- package/dist/tools/builtins/browser.js.map +1 -0
- package/dist/tools/builtins/computer-use-coordinates.d.ts +65 -0
- package/dist/tools/builtins/computer-use-coordinates.d.ts.map +1 -0
- package/dist/tools/builtins/computer-use-coordinates.js +123 -0
- package/dist/tools/builtins/computer-use-coordinates.js.map +1 -0
- package/dist/tools/builtins/computer-use-image.d.ts +77 -0
- package/dist/tools/builtins/computer-use-image.d.ts.map +1 -0
- package/dist/tools/builtins/computer-use-image.js +223 -0
- package/dist/tools/builtins/computer-use-image.js.map +1 -0
- package/dist/tools/builtins/computer-use.d.ts +519 -14
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +1188 -183
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/index.d.ts +2 -1
- package/dist/tools/builtins/index.d.ts.map +1 -1
- package/dist/tools/builtins/index.js +1 -1
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/skill.d.ts +74 -0
- package/dist/tools/builtins/skill.d.ts.map +1 -1
- package/dist/tools/builtins/skill.js +214 -159
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/defineTool.d.ts +4 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +8 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/schedules/index.d.ts +5 -0
- package/dist/tools/schedules/index.d.ts.map +1 -0
- package/dist/tools/schedules/index.js +4 -0
- package/dist/tools/schedules/index.js.map +1 -0
- package/dist/tools/schedules/loop-tool.d.ts +14 -0
- package/dist/tools/schedules/loop-tool.d.ts.map +1 -0
- package/dist/tools/schedules/loop-tool.js +81 -0
- package/dist/tools/schedules/loop-tool.js.map +1 -0
- package/dist/tools/schedules/present.d.ts +16 -0
- package/dist/tools/schedules/present.d.ts.map +1 -0
- package/dist/tools/schedules/present.js +71 -0
- package/dist/tools/schedules/present.js.map +1 -0
- package/dist/tools/schedules/prompt-scan.d.ts +17 -0
- package/dist/tools/schedules/prompt-scan.d.ts.map +1 -0
- package/dist/tools/schedules/prompt-scan.js +92 -0
- package/dist/tools/schedules/prompt-scan.js.map +1 -0
- package/dist/tools/schedules/schedule-tool.d.ts +17 -0
- package/dist/tools/schedules/schedule-tool.d.ts.map +1 -0
- package/dist/tools/schedules/schedule-tool.js +418 -0
- package/dist/tools/schedules/schedule-tool.js.map +1 -0
- package/dist/tools/schedules/types.d.ts +252 -0
- package/dist/tools/schedules/types.d.ts.map +1 -0
- package/dist/tools/schedules/types.js +11 -0
- package/dist/tools/schedules/types.js.map +1 -0
- package/dist/types/authorization/index.d.ts +107 -9
- package/dist/types/authorization/index.d.ts.map +1 -1
- package/dist/types/authorization/index.js +16 -1
- package/dist/types/authorization/index.js.map +1 -1
- package/dist/types/browser/index.d.ts +280 -0
- package/dist/types/browser/index.d.ts.map +1 -0
- package/dist/types/browser/index.js +12 -0
- package/dist/types/browser/index.js.map +1 -0
- package/dist/types/computer-use/index.d.ts +176 -0
- package/dist/types/computer-use/index.d.ts.map +1 -1
- package/dist/types/computer-use/index.js.map +1 -1
- package/dist/types/session/events.d.ts +6 -0
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/session/records.d.ts +23 -0
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +9 -0
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/tool/index.d.ts +60 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +7 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/dist/utils/frontmatter.d.ts +18 -2
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +13 -3
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/id.d.ts +8 -0
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +12 -0
- package/dist/utils/id.js.map +1 -1
- package/package.json +3 -1
- package/src/authorization/gate.ts +37 -4
- package/src/authorization/rules.ts +55 -7
- package/src/authorization/shell-lexer.ts +109 -51
- package/src/bridge/a2a/mapper.ts +2 -0
- package/src/bridge/sse/mapper.ts +1 -0
- package/src/directory/types.ts +2 -0
- package/src/pricing/catalogue.generated.ts +28 -4
- package/src/pricing/rates.source.json +27 -6
- package/src/prompt/coding-agent-doctrine.ts +1 -0
- package/src/public-runtime.ts +43 -1
- package/src/public-tools.ts +54 -1
- package/src/public-types.ts +55 -0
- package/src/registry/tool/callable.ts +37 -0
- package/src/registry/tool/execute.ts +8 -1
- package/src/runtime/query/declined.ts +12 -0
- package/src/runtime/query/executor/tool-call-admission.ts +60 -16
- package/src/runtime/query/executor.ts +36 -5
- package/src/runtime/query/index.ts +1 -0
- package/src/runtime/query/iteration/index.ts +8 -0
- package/src/runtime/query/iteration/phases/context.ts +6 -0
- package/src/runtime/query/iteration/phases/handoff.ts +74 -0
- package/src/runtime/query/iteration/phases/index.ts +1 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +11 -4
- package/src/runtime/query/resume-pending.ts +3 -2
- package/src/runtime/query/review-policy.ts +107 -18
- package/src/schedules/cron.ts +202 -0
- package/src/schedules/describe.ts +138 -0
- package/src/schedules/errors.ts +15 -0
- package/src/schedules/evaluate.ts +178 -0
- package/src/schedules/index.ts +18 -0
- package/src/schedules/next-fire.ts +257 -0
- package/src/schedules/spec.ts +210 -0
- package/src/schedules/types.ts +163 -0
- package/src/schedules/tz.ts +155 -0
- package/src/skills/index.ts +1 -1
- package/src/skills/loader.ts +55 -4
- package/src/skills/registry.ts +8 -0
- package/src/tools/builtins/browser-url.ts +251 -0
- package/src/tools/builtins/browser.ts +817 -0
- package/src/tools/builtins/computer-use-coordinates.ts +144 -0
- package/src/tools/builtins/computer-use-image.ts +278 -0
- package/src/tools/builtins/computer-use.ts +1485 -191
- package/src/tools/builtins/index.ts +7 -1
- package/src/tools/builtins/skill.ts +304 -156
- package/src/tools/defineTool.ts +13 -0
- package/src/tools/schedules/index.ts +4 -0
- package/src/tools/schedules/loop-tool.ts +85 -0
- package/src/tools/schedules/present.ts +88 -0
- package/src/tools/schedules/prompt-scan.ts +96 -0
- package/src/tools/schedules/schedule-tool.ts +482 -0
- package/src/tools/schedules/types.ts +265 -0
- package/src/types/authorization/index.ts +81 -2
- package/src/types/browser/index.ts +341 -0
- package/src/types/computer-use/index.ts +202 -0
- package/src/types/session/events.ts +6 -0
- package/src/types/session/records.ts +10 -0
- package/src/types/tool/index.ts +61 -0
- package/src/types/tool/presentation.ts +7 -0
- package/src/utils/frontmatter.ts +29 -3
- package/src/utils/id.ts +14 -0
package/src/types/tool/index.ts
CHANGED
|
@@ -42,6 +42,12 @@ export interface SkillRegistryRef {
|
|
|
42
42
|
registeredName: string
|
|
43
43
|
description: string
|
|
44
44
|
location: string
|
|
45
|
+
/**
|
|
46
|
+
* The skill's directory as the host reads it. Optional so a registry
|
|
47
|
+
* written before it existed still satisfies this interface; what the
|
|
48
|
+
* `skill` tool hands a host's `resolveModelDirectory` to map.
|
|
49
|
+
*/
|
|
50
|
+
directory?: string
|
|
45
51
|
allowedTools?: string
|
|
46
52
|
invocation?: 'model' | 'operator' | 'both'
|
|
47
53
|
}[]
|
|
@@ -50,6 +56,7 @@ export interface SkillRegistryRef {
|
|
|
50
56
|
registeredName: string
|
|
51
57
|
description: string
|
|
52
58
|
location: string
|
|
59
|
+
directory?: string
|
|
53
60
|
allowedTools?: string
|
|
54
61
|
invocation?: 'model' | 'operator' | 'both'
|
|
55
62
|
}[]
|
|
@@ -715,6 +722,31 @@ export interface ToolResult {
|
|
|
715
722
|
* must not lose: what its controls do, where things are, what failed.
|
|
716
723
|
*/
|
|
717
724
|
workingState?: readonly import('../../compaction/types.js').WorkingStatePin[]
|
|
725
|
+
/**
|
|
726
|
+
* This result needs a person before the turn can go on — a sign-in page,
|
|
727
|
+
* a CAPTCHA, a second factor, anything the model must not try to answer
|
|
728
|
+
* itself.
|
|
729
|
+
*
|
|
730
|
+
* The result is committed like any other: it reaches the transcript and
|
|
731
|
+
* the session log with the rest of its batch. Then, instead of calling
|
|
732
|
+
* the model again, the kernel writes a checkpoint and ends the segment
|
|
733
|
+
* with `turn_paused` carrying this value. Resuming the turn continues
|
|
734
|
+
* from that checkpoint, and the next step is a model call that sees the
|
|
735
|
+
* results. Inside a delegated child there is no person to hand to, so
|
|
736
|
+
* the child's turn fails with {@link ToolHandoff.reason} instead.
|
|
737
|
+
*/
|
|
738
|
+
handoff?: ToolHandoff
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* A tool's request to stop the turn for a person. See {@link ToolResult.handoff}.
|
|
743
|
+
*/
|
|
744
|
+
export interface ToolHandoff {
|
|
745
|
+
readonly kind: 'human-required'
|
|
746
|
+
/** Operator-facing text: what the person has to do before the turn resumes. */
|
|
747
|
+
readonly reason: string
|
|
748
|
+
/** Structured facts a host can render or act on, such as an origin or a command. */
|
|
749
|
+
readonly detail?: Readonly<Record<string, string>>
|
|
718
750
|
}
|
|
719
751
|
|
|
720
752
|
/**
|
|
@@ -810,6 +842,23 @@ export interface ToolDefinition<TInput = unknown> extends ToolPresentation<TInpu
|
|
|
810
842
|
* the safe direction to be wrong in.
|
|
811
843
|
*/
|
|
812
844
|
pathArgument?: string
|
|
845
|
+
/**
|
|
846
|
+
* The argument that holds an absolute URL the tool has already
|
|
847
|
+
* canonicalised in its input schema — one spelling, no whitespace.
|
|
848
|
+
*
|
|
849
|
+
* Declared so an `argument_pattern` rule tests the URL whole. Without it
|
|
850
|
+
* the rule reads every argument as a possible command line, and a URL's
|
|
851
|
+
* query separators (`&`, `;`, `|`) cut it into "segments": an `allow` for
|
|
852
|
+
* `^https://github\.com(?:[/?#]|$)` then declined
|
|
853
|
+
* `https://github.com/search?q=a&type=code`, because `type=code` is not
|
|
854
|
+
* GitHub. A `deny` or `review` is unaffected either way; only an `allow`
|
|
855
|
+
* needed every segment to match.
|
|
856
|
+
*
|
|
857
|
+
* Declare it only for an argument the input schema itself canonicalises
|
|
858
|
+
* to a URL. A free-text argument that happens to hold one keeps the
|
|
859
|
+
* command-line reading, which is the safe direction to be wrong in.
|
|
860
|
+
*/
|
|
861
|
+
urlArgument?: string
|
|
813
862
|
/**
|
|
814
863
|
* The boolean argument by which a call asks to run outside the turn's
|
|
815
864
|
* sandbox, when the tool offers that at all (the shipped `bash` does).
|
|
@@ -885,6 +934,18 @@ export interface ToolDefinition<TInput = unknown> extends ToolPresentation<TInpu
|
|
|
885
934
|
isReadOnly?(input: TInput): boolean
|
|
886
935
|
isDestructive?(input: TInput): boolean
|
|
887
936
|
isConcurrencySafe?(input: TInput): boolean
|
|
937
|
+
/**
|
|
938
|
+
* This call sends what is on the operator's screen to the model provider:
|
|
939
|
+
* a screenshot, the titles of the open windows, a window's accessibility
|
|
940
|
+
* tree.
|
|
941
|
+
*
|
|
942
|
+
* Orthogonal to {@link isReadOnly}: a screenshot changes nothing and is
|
|
943
|
+
* still the one read a person may want to allow before it happens. A
|
|
944
|
+
* review policy given a consent record (`createReviewHandler`'s
|
|
945
|
+
* `screenConsent`) asks once per session before the first such call.
|
|
946
|
+
* Absent means the tool never does.
|
|
947
|
+
*/
|
|
948
|
+
capturesScreen?(input: TInput): boolean
|
|
888
949
|
|
|
889
950
|
/**
|
|
890
951
|
* Opt-in ordering boundary in a direct model tool-call batch. Earlier
|
|
@@ -26,6 +26,13 @@ export type ToolCallView =
|
|
|
26
26
|
readonly activity?: 'exploration'
|
|
27
27
|
/** A successful result may add no information beyond the completed call row. */
|
|
28
28
|
readonly visibility?: 'hidden'
|
|
29
|
+
/**
|
|
30
|
+
* For a result: the person declined on the tool's own screen (a
|
|
31
|
+
* confirmation they cancelled). The call did not succeed, but
|
|
32
|
+
* nothing failed either, so a host draws it as neither: `label` says
|
|
33
|
+
* what did not happen ("Cancelled — nothing was saved").
|
|
34
|
+
*/
|
|
35
|
+
readonly outcome?: 'cancelled'
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* A change to a document. `path` is optional because not every diff is
|
package/src/utils/frontmatter.ts
CHANGED
|
@@ -132,6 +132,19 @@ export interface FrontmatterOptions {
|
|
|
132
132
|
* way.
|
|
133
133
|
*/
|
|
134
134
|
readonly lists?: readonly string[]
|
|
135
|
+
/**
|
|
136
|
+
* The keys the caller reads. When given, a top-level key it answers
|
|
137
|
+
* `false` for is skipped whole — its value and every indented line under
|
|
138
|
+
* it — and does not appear in the result.
|
|
139
|
+
*
|
|
140
|
+
* The refusals in {@link UNSUPPORTED_YAML} exist so a value the caller
|
|
141
|
+
* USES is never read wrongly. A key nobody reads cannot be read wrongly,
|
|
142
|
+
* and refusing the whole file over it made a skill written for another
|
|
143
|
+
* tool (`argument-hint: [file]`, a `hooks:` block with a list in it)
|
|
144
|
+
* unusable here for the sake of a field this kernel ignores. Absent, every
|
|
145
|
+
* key is parsed and refused exactly as before.
|
|
146
|
+
*/
|
|
147
|
+
readonly readsKey?: (key: string) => boolean
|
|
135
148
|
}
|
|
136
149
|
|
|
137
150
|
export interface ParsedFrontmatter {
|
|
@@ -153,15 +166,19 @@ export interface ParsedFrontmatter {
|
|
|
153
166
|
readonly body: string
|
|
154
167
|
}
|
|
155
168
|
|
|
169
|
+
/** Optional behaviour for {@link parseFrontmatter}: the same as {@link FrontmatterOptions}. */
|
|
170
|
+
export type ParseFrontmatterOptions = FrontmatterOptions
|
|
171
|
+
|
|
156
172
|
/**
|
|
157
173
|
* Parse a markdown file's `---` frontmatter.
|
|
158
174
|
*
|
|
159
175
|
* @param raw The file's full contents. LF and CRLF both parse.
|
|
160
176
|
* @param source A label for error messages — a path, or a phrase naming the
|
|
161
177
|
* file. Used verbatim, so the caller controls how its own errors read.
|
|
178
|
+
* @param options See {@link FrontmatterOptions}.
|
|
162
179
|
* @throws If the frontmatter is absent, unclosed, or uses YAML this reader
|
|
163
|
-
* does not implement. It never returns a partial
|
|
164
|
-
* for a file it could not read.
|
|
180
|
+
* does not implement in a key the caller reads. It never returns a partial
|
|
181
|
+
* or empty result to stand in for a file it could not read.
|
|
165
182
|
*/
|
|
166
183
|
export function parseFrontmatter(
|
|
167
184
|
raw: string,
|
|
@@ -198,12 +215,15 @@ export function parseFrontmatter(
|
|
|
198
215
|
const blocks = new Map<string, Map<string, string>>()
|
|
199
216
|
const lists = new Map<string, string[]>()
|
|
200
217
|
let currentKey: string | undefined
|
|
218
|
+
// The current top-level key is one the caller does not read: its value
|
|
219
|
+
// and its indented lines are skipped rather than parsed or refused.
|
|
220
|
+
let skipping = false
|
|
201
221
|
|
|
202
222
|
for (const line of frontmatterRaw.split(LINE_SPLIT)) {
|
|
203
223
|
if (!line.trim() || line.trimStart().startsWith('#')) continue
|
|
204
224
|
|
|
205
225
|
if (/^\s/.test(line)) {
|
|
206
|
-
if (!currentKey) continue
|
|
226
|
+
if (!currentKey || skipping) continue
|
|
207
227
|
|
|
208
228
|
// A block sequence item. Read as a list when the caller named this
|
|
209
229
|
// key in `options.lists`; refused, not skipped, everywhere else.
|
|
@@ -254,6 +274,12 @@ export function parseFrontmatter(
|
|
|
254
274
|
const colonIdx = line.indexOf(':')
|
|
255
275
|
if (colonIdx === -1) continue
|
|
256
276
|
const key = line.slice(0, colonIdx).trim()
|
|
277
|
+
if (options.readsKey && !options.readsKey(key)) {
|
|
278
|
+
currentKey = key
|
|
279
|
+
skipping = true
|
|
280
|
+
continue
|
|
281
|
+
}
|
|
282
|
+
skipping = false
|
|
257
283
|
const value = normalizeScalar(line.slice(colonIdx + 1))
|
|
258
284
|
|
|
259
285
|
if (listKeys.has(key) && /^\[.*\]$/.test(value)) {
|
package/src/utils/id.ts
CHANGED
|
@@ -197,6 +197,20 @@ export function generateDeliverableId(): DeliverableId {
|
|
|
197
197
|
return generateId()
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* The id of a scheduled job, for a host that stores schedules (the CLI's
|
|
202
|
+
* `NAMZU_HOME/schedule/`). A plain UUIDv7 string: jobs are the host's records,
|
|
203
|
+
* not a kernel entity, so there is no branded kind for them.
|
|
204
|
+
*/
|
|
205
|
+
export function generateScheduleJobId(): string {
|
|
206
|
+
return uuidv7()
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** The id of one run of a scheduled job. See {@link generateScheduleJobId}. */
|
|
210
|
+
export function generateScheduleRunId(): string {
|
|
211
|
+
return uuidv7()
|
|
212
|
+
}
|
|
213
|
+
|
|
200
214
|
/** Entity kinds are supplied by a typed field or storage collection. */
|
|
201
215
|
export interface EntityIdByKind {
|
|
202
216
|
turn: TurnId
|