primitive-admin 1.1.0-alpha.81 → 1.1.0-alpha.83

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.
Files changed (109) hide show
  1. package/assets/skill/skills/primitive-platform/SKILL.md +12 -0
  2. package/dist/src/commands/documents.js +455 -22
  3. package/dist/src/commands/documents.js.map +1 -1
  4. package/dist/src/commands/functions.js +889 -76
  5. package/dist/src/commands/functions.js.map +1 -1
  6. package/dist/src/commands/locks.js +15 -1
  7. package/dist/src/commands/locks.js.map +1 -1
  8. package/dist/src/commands/prompts.js +19 -2
  9. package/dist/src/commands/prompts.js.map +1 -1
  10. package/dist/src/commands/sync.d.ts +50 -0
  11. package/dist/src/commands/sync.js +587 -316
  12. package/dist/src/commands/sync.js.map +1 -1
  13. package/dist/src/commands/workflows.d.ts +1 -29
  14. package/dist/src/commands/workflows.js +8 -109
  15. package/dist/src/commands/workflows.js.map +1 -1
  16. package/dist/src/lib/api-client.d.ts +191 -2
  17. package/dist/src/lib/api-client.js +283 -7
  18. package/dist/src/lib/api-client.js.map +1 -1
  19. package/dist/src/lib/config-object-descriptor.js +12 -4
  20. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  21. package/dist/src/lib/document-ingest-artifact.d.ts +120 -0
  22. package/dist/src/lib/document-ingest-artifact.js +505 -0
  23. package/dist/src/lib/document-ingest-artifact.js.map +1 -0
  24. package/dist/src/lib/document-ingest-input.d.ts +51 -0
  25. package/dist/src/lib/document-ingest-input.js +132 -0
  26. package/dist/src/lib/document-ingest-input.js.map +1 -0
  27. package/dist/src/lib/document-ingest.d.ts +78 -0
  28. package/dist/src/lib/document-ingest.js +231 -0
  29. package/dist/src/lib/document-ingest.js.map +1 -0
  30. package/dist/src/lib/env-resolver-core.d.ts +2 -2
  31. package/dist/src/lib/env-resolver-core.js +2 -2
  32. package/dist/src/lib/function-bundle.d.ts +6 -0
  33. package/dist/src/lib/function-bundle.js +8 -0
  34. package/dist/src/lib/function-bundle.js.map +1 -1
  35. package/dist/src/lib/function-collect.d.ts +1 -1
  36. package/dist/src/lib/function-collect.js +16 -0
  37. package/dist/src/lib/function-collect.js.map +1 -1
  38. package/dist/src/lib/function-db-types.d.ts +4 -0
  39. package/dist/src/lib/function-db-types.js +46 -2
  40. package/dist/src/lib/function-db-types.js.map +1 -1
  41. package/dist/src/lib/function-document-types.d.ts +83 -0
  42. package/dist/src/lib/function-document-types.js +137 -0
  43. package/dist/src/lib/function-document-types.js.map +1 -1
  44. package/dist/src/lib/function-grants-preflight.js +5 -0
  45. package/dist/src/lib/function-grants-preflight.js.map +1 -1
  46. package/dist/src/lib/function-log-lines.d.ts +76 -0
  47. package/dist/src/lib/function-log-lines.js +160 -0
  48. package/dist/src/lib/function-log-lines.js.map +1 -0
  49. package/dist/src/lib/function-log-row.d.ts +29 -0
  50. package/dist/src/lib/function-log-row.js +73 -0
  51. package/dist/src/lib/function-log-row.js.map +1 -0
  52. package/dist/src/lib/function-log-tail.d.ts +51 -2
  53. package/dist/src/lib/function-log-tail.js +160 -13
  54. package/dist/src/lib/function-log-tail.js.map +1 -1
  55. package/dist/src/lib/function-run.d.ts +289 -0
  56. package/dist/src/lib/function-run.js +389 -0
  57. package/dist/src/lib/function-run.js.map +1 -0
  58. package/dist/src/lib/function-schema-codegen.d.ts +17 -9
  59. package/dist/src/lib/function-schema-codegen.js +30 -29
  60. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  61. package/dist/src/lib/function-sync.d.ts +226 -30
  62. package/dist/src/lib/function-sync.js +731 -77
  63. package/dist/src/lib/function-sync.js.map +1 -1
  64. package/dist/src/lib/function-versions.d.ts +122 -0
  65. package/dist/src/lib/function-versions.js +182 -0
  66. package/dist/src/lib/function-versions.js.map +1 -0
  67. package/dist/src/lib/generated-config-surfaces.d.ts +561 -91
  68. package/dist/src/lib/generated-config-surfaces.js +1858 -287
  69. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  70. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  71. package/dist/src/lib/generated-sdk-types.js +1 -1
  72. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  73. package/dist/src/lib/log-inspection.d.ts +2 -0
  74. package/dist/src/lib/log-inspection.js +4 -0
  75. package/dist/src/lib/log-inspection.js.map +1 -1
  76. package/dist/src/lib/output.d.ts +15 -0
  77. package/dist/src/lib/output.js +28 -0
  78. package/dist/src/lib/output.js.map +1 -1
  79. package/dist/src/lib/prompt-schema-codegen.d.ts +94 -0
  80. package/dist/src/lib/prompt-schema-codegen.js +212 -0
  81. package/dist/src/lib/prompt-schema-codegen.js.map +1 -0
  82. package/dist/src/lib/snapshot-audit-source.d.ts +45 -0
  83. package/dist/src/lib/snapshot-audit-source.js +58 -0
  84. package/dist/src/lib/snapshot-audit-source.js.map +1 -0
  85. package/dist/src/lib/snapshot-audit-store.d.ts +52 -0
  86. package/dist/src/lib/snapshot-audit-store.js +196 -0
  87. package/dist/src/lib/snapshot-audit-store.js.map +1 -0
  88. package/dist/src/lib/snapshot-audit.d.ts +207 -0
  89. package/dist/src/lib/snapshot-audit.js +431 -0
  90. package/dist/src/lib/snapshot-audit.js.map +1 -0
  91. package/dist/src/lib/snapshot-build-rows.d.ts +60 -0
  92. package/dist/src/lib/snapshot-build-rows.js +87 -0
  93. package/dist/src/lib/snapshot-build-rows.js.map +1 -0
  94. package/dist/src/lib/snapshot-manifest-layout.d.ts +61 -0
  95. package/dist/src/lib/snapshot-manifest-layout.js +70 -0
  96. package/dist/src/lib/snapshot-manifest-layout.js.map +1 -0
  97. package/dist/src/lib/step-run-table.d.ts +43 -0
  98. package/dist/src/lib/step-run-table.js +129 -0
  99. package/dist/src/lib/step-run-table.js.map +1 -0
  100. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +26 -13
  101. package/dist/src/lib/swift-codegen/functionGenerator.js +38 -27
  102. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  103. package/dist/src/lib/sync-selectors.d.ts +45 -2
  104. package/dist/src/lib/sync-selectors.js +66 -5
  105. package/dist/src/lib/sync-selectors.js.map +1 -1
  106. package/dist/src/lib/workflow-toml-validator.d.ts +9 -5
  107. package/dist/src/lib/workflow-toml-validator.js +18 -10
  108. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  109. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"function-grants-preflight.js","sourceRoot":"","sources":["../../../src/lib/function-grants-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AAcxC,qDAAqD;AACrD,MAAM,UAAU,wBAAwB,CACtC,SAAiB;IAEjB,OAAO;QACL,YAAY,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,aAAa,CAAC;KACpE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAClB,SAAiB,EACjB,OAAe,EACf,KAAa;IAEb,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACvE,IAAI,IAAS,CAAC;QACd,IAAI,CAAC;YACH,IAAI,GAAG,eAAe,CAAC,YAAY,CAAC,IAA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;YACtE,YAAY,EAAE,YAAY,CAAC,YAAY;SACxC,CAAC,EAAE,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"function-grants-preflight.js","sourceRoot":"","sources":["../../../src/lib/function-grants-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AAcxC,qDAAqD;AACrD,MAAM,UAAU,wBAAwB,CACtC,SAAiB;IAEjB,OAAO;QACL,YAAY,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,aAAa,CAAC;KACpE,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,WAAW,CAClB,SAAiB,EACjB,OAAe,EACf,KAAa;IAEb,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACvE,IAAI,IAAS,CAAC;QACd,IAAI,CAAC;YACH,IAAI,GAAG,eAAe,CAAC,YAAY,CAAC,IA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E;YACtE,YAAY,EAAE,YAAY,CAAC,YAAY;SACxC,CAAC,EAAE,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * One invocation's captured console output, in the order it was printed —
3
+ * #3453 (D3453-005).
4
+ *
5
+ * `primitive functions logs --run <run-id>` used to print the same one-row-per
6
+ * record table the listing prints, so the LINES — the thing an operator opened
7
+ * the logs for — were only reachable through `--json`. This renders them, under
8
+ * the step that wrote them.
9
+ *
10
+ * Pure, and separate from the command, for the reason `function-log-row.ts`
11
+ * gives: a rendering rule that lives inside an action can only be tested by
12
+ * spawning the CLI, and this one has enough cases (two orderings, a header that
13
+ * changes, a throw, a pre-change record) that spawning for each would be the
14
+ * wrong trade.
15
+ */
16
+ /** The marker a truncated record ends with, so loss is never silent. */
17
+ export declare const TRUNCATION_MARKER = "\u2026 truncated: the platform's per-record cap dropped later lines";
18
+ /**
19
+ * What an EMPTY record whose attempt ended in the engine says — #3564,
20
+ * criterion 2 (D3564-007).
21
+ *
22
+ * The filing's own complaint: the invocation log held no console output for
23
+ * these attempts, with `truncated`, `logsUnavailable` and `contentSuppressed`
24
+ * all unset, so the silence read as "logs lost" when it meant "the handler
25
+ * printed nothing before the engine took the isolate away". This renderer
26
+ * printed nothing at all for such a record, which is the reading the filing
27
+ * asks to be able to make.
28
+ *
29
+ * Two facts, never collapsed into one: the first half says the attempt ended
30
+ * in the engine, and the SECOND half is chosen by the drain's own flags. A
31
+ * drain that failed — which `DrainedLogs.unavailable` names isolate eviction
32
+ * as a cause of — is reported as unavailable rather than as an empty handler,
33
+ * because those are opposite statements and this is precisely the case where
34
+ * guessing would be wrong.
35
+ */
36
+ export declare const ENGINE_END_PREFIX = "ended in the engine";
37
+ /**
38
+ * One record's console output, ready to print under its `functionLogLine`.
39
+ *
40
+ * A header is emitted whenever the label CHANGES, so two lines from one body
41
+ * sit under one header and a body re-entered after another step gets its own.
42
+ * A `thrown` entry — the wrapper's own record of a body that failed — takes a
43
+ * `!` in the gutter rather than an extra column, so the columns stay aligned.
44
+ *
45
+ * A record with NO lines whose attempt ended in the engine says so instead of
46
+ * printing nothing (#3564, {@link ENGINE_END_PREFIX}). The derivation is by
47
+ * the record's own `endedIn`, which the platform derived from its stored code
48
+ * — never by re-reading its message here, so a record written before this
49
+ * child renders exactly as it rendered then (edge 32).
50
+ */
51
+ export declare function renderInvocationLines(record: any): string[];
52
+ /** What `logs --run` was able to read before it renders anything. */
53
+ export interface RunLogsInput {
54
+ /** The filtered page, NEWEST first, as the listing route answers it. */
55
+ records: any[];
56
+ /** The run's step rows, or null when the read failed. */
57
+ trace: any[] | null;
58
+ /** The trace read's failure, if it had one. */
59
+ traceError?: string | null;
60
+ }
61
+ /**
62
+ * The whole of `logs --run`'s human output — #3453 (D3453-005).
63
+ *
64
+ * Returned rather than printed so every one of its rules is decidable without
65
+ * a server (#3187's lesson): which runs get a table, what a failed trace read
66
+ * costs, and the order the records come out in. The command does the two I/O
67
+ * reads and prints what comes back.
68
+ *
69
+ * Records are reversed because the listing answers newest first and a run is
70
+ * read forwards — an operator following what happened wants the first
71
+ * invocation at the top.
72
+ */
73
+ export declare function renderRunLogs(input: RunLogsInput): {
74
+ lines: string[];
75
+ warning: string | null;
76
+ };
@@ -0,0 +1,160 @@
1
+ /**
2
+ * One invocation's captured console output, in the order it was printed —
3
+ * #3453 (D3453-005).
4
+ *
5
+ * `primitive functions logs --run <run-id>` used to print the same one-row-per
6
+ * record table the listing prints, so the LINES — the thing an operator opened
7
+ * the logs for — were only reachable through `--json`. This renders them, under
8
+ * the step that wrote them.
9
+ *
10
+ * Pure, and separate from the command, for the reason `function-log-row.ts`
11
+ * gives: a rendering rule that lives inside an action can only be tested by
12
+ * spawning the CLI, and this one has enough cases (two orderings, a header that
13
+ * changes, a throw, a pre-change record) that spawning for each would be the
14
+ * wrong trade.
15
+ */
16
+ import { functionLogLine } from "./function-log-row.js";
17
+ import { renderStepRunTable } from "./step-run-table.js";
18
+ /** The marker a truncated record ends with, so loss is never silent. */
19
+ export const TRUNCATION_MARKER = "… truncated: the platform's per-record cap dropped later lines";
20
+ /**
21
+ * What an EMPTY record whose attempt ended in the engine says — #3564,
22
+ * criterion 2 (D3564-007).
23
+ *
24
+ * The filing's own complaint: the invocation log held no console output for
25
+ * these attempts, with `truncated`, `logsUnavailable` and `contentSuppressed`
26
+ * all unset, so the silence read as "logs lost" when it meant "the handler
27
+ * printed nothing before the engine took the isolate away". This renderer
28
+ * printed nothing at all for such a record, which is the reading the filing
29
+ * asks to be able to make.
30
+ *
31
+ * Two facts, never collapsed into one: the first half says the attempt ended
32
+ * in the engine, and the SECOND half is chosen by the drain's own flags. A
33
+ * drain that failed — which `DrainedLogs.unavailable` names isolate eviction
34
+ * as a cause of — is reported as unavailable rather than as an empty handler,
35
+ * because those are opposite statements and this is precisely the case where
36
+ * guessing would be wrong.
37
+ */
38
+ export const ENGINE_END_PREFIX = "ended in the engine";
39
+ function engineEndLine(record) {
40
+ const why = record?.logsUnavailable === true
41
+ ? "logs unavailable"
42
+ : record?.contentSuppressed === true
43
+ ? "output suppressed"
44
+ : "no handler output";
45
+ return `${ENGINE_END_PREFIX} — ${why}`;
46
+ }
47
+ const INDENT = " ";
48
+ /**
49
+ * Put one record's two arrays back into CAPTURE order.
50
+ *
51
+ * The writer persists `stdout` and `stderr` as two arrays filtered by stream
52
+ * and `t` is a millisecond offset, so `console.error("first")` followed by
53
+ * `console.log("second")` in the same millisecond has no surviving order in
54
+ * the record itself: merging by `t` prints them backwards. `n` is stamped at
55
+ * capture, in one buffer, and is what restores it.
56
+ *
57
+ * A record written before #3453 carries no `n` at all, and one entry having it
58
+ * while another does not is not a state any writer produces — so the fallback
59
+ * is chosen for the WHOLE record rather than per entry. Interleaving two
60
+ * orders would put entries in an order neither of them claims.
61
+ *
62
+ * The `t` fallback sorts stably with stdout first on a tie, which is the order
63
+ * the two arrays already sit in.
64
+ */
65
+ function inCaptureOrder(record) {
66
+ const stdout = Array.isArray(record?.stdout) ? record.stdout : [];
67
+ const stderr = Array.isArray(record?.stderr) ? record.stderr : [];
68
+ const merged = [...stdout, ...stderr];
69
+ const everyEntryNumbered = merged.length > 0 && merged.every((entry) => Number.isFinite(entry?.n));
70
+ const key = everyEntryNumbered
71
+ ? (entry) => Number(entry.n)
72
+ : (entry) => Number(entry.t ?? 0);
73
+ // `Array.prototype.sort` is stable, so equal keys keep the order above —
74
+ // stdout before stderr.
75
+ return merged.slice().sort((a, b) => key(a) - key(b));
76
+ }
77
+ /** `step <name> #<occurrence> attempt <n>`, or null between steps. */
78
+ function headerFor(entry) {
79
+ if (!entry?.step || typeof entry.step.name !== "string")
80
+ return null;
81
+ return `step ${entry.step.name} #${entry.step.occurrence ?? 0} attempt ${entry.attempt ?? 1}`;
82
+ }
83
+ /**
84
+ * One record's console output, ready to print under its `functionLogLine`.
85
+ *
86
+ * A header is emitted whenever the label CHANGES, so two lines from one body
87
+ * sit under one header and a body re-entered after another step gets its own.
88
+ * A `thrown` entry — the wrapper's own record of a body that failed — takes a
89
+ * `!` in the gutter rather than an extra column, so the columns stay aligned.
90
+ *
91
+ * A record with NO lines whose attempt ended in the engine says so instead of
92
+ * printing nothing (#3564, {@link ENGINE_END_PREFIX}). The derivation is by
93
+ * the record's own `endedIn`, which the platform derived from its stored code
94
+ * — never by re-reading its message here, so a record written before this
95
+ * child renders exactly as it rendered then (edge 32).
96
+ */
97
+ export function renderInvocationLines(record) {
98
+ const out = [];
99
+ let currentHeader = null;
100
+ let headerEmitted = false;
101
+ const entries = inCaptureOrder(record);
102
+ for (const entry of entries) {
103
+ const header = headerFor(entry);
104
+ if (header !== currentHeader) {
105
+ currentHeader = header;
106
+ headerEmitted = false;
107
+ }
108
+ if (header && !headerEmitted) {
109
+ out.push(`${INDENT}${header}`);
110
+ headerEmitted = true;
111
+ }
112
+ const indent = header ? INDENT.repeat(2) : INDENT;
113
+ const gutter = entry?.thrown === true ? `${indent.slice(0, -2)}! ` : indent;
114
+ const stream = entry?.s === "err" ? "err" : "out";
115
+ out.push(`${gutter}+${Number(entry?.t ?? 0)}ms ${stream} ${String(entry?.line ?? "")}`);
116
+ }
117
+ // #3564 — the empty record, explained. Only when the record really has no
118
+ // lines: one that printed something says more than the sentence does, and a
119
+ // reader who can see the output does not need to be told there is some.
120
+ if (entries.length === 0 && record?.endedIn === "engine") {
121
+ out.push(`${INDENT}${engineEndLine(record)}`);
122
+ }
123
+ // Said out loud, because the alternative is output that looks complete after
124
+ // the cap dropped the later lines or the throw entry. The record persists the
125
+ // boolean and not the count (F-3453-009), so the marker cannot name one.
126
+ if (record?.truncated === true)
127
+ out.push(`${INDENT}${TRUNCATION_MARKER}`);
128
+ return out;
129
+ }
130
+ /**
131
+ * The whole of `logs --run`'s human output — #3453 (D3453-005).
132
+ *
133
+ * Returned rather than printed so every one of its rules is decidable without
134
+ * a server (#3187's lesson): which runs get a table, what a failed trace read
135
+ * costs, and the order the records come out in. The command does the two I/O
136
+ * reads and prints what comes back.
137
+ *
138
+ * Records are reversed because the listing answers newest first and a run is
139
+ * read forwards — an operator following what happened wants the first
140
+ * invocation at the top.
141
+ */
142
+ export function renderRunLogs(input) {
143
+ const lines = [];
144
+ // A trace this reader could not fetch is not a reason to withhold the
145
+ // output: the lines say more than the failure does.
146
+ const warning = input.traceError
147
+ ? `Could not read the step trace: ${input.traceError}`
148
+ : null;
149
+ // A request invocation has no step rows at all, and an empty table would
150
+ // say there were steps and none ran.
151
+ if (input.trace && input.trace.length > 0) {
152
+ lines.push(renderStepRunTable(input.trace), "");
153
+ }
154
+ for (const record of [...(input.records ?? [])].reverse()) {
155
+ lines.push(functionLogLine(record));
156
+ lines.push(...renderInvocationLines(record));
157
+ }
158
+ return { lines, warning };
159
+ }
160
+ //# sourceMappingURL=function-log-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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B;IAI/C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,sEAAsE;IACtE,oDAAoD;IACpD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU;QAC9B,CAAC,CAAC,kCAAkC,KAAK,CAAC,UAAU,EAAE;QACtD,CAAC,CAAC,IAAI,CAAC;IAET,yEAAyE;IACzE,qCAAqC;IACrC,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAC1D,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * One invocation, as a human reads it — the columns and the tail line.
3
+ *
4
+ * Extracted from `commands/functions.ts` by #3462 so the VERSION it added has
5
+ * somewhere to be tested. The one-shot table, the `--invocation` point read and
6
+ * the `--follow` tail all render the same facts in the same order, and three
7
+ * copies of that order in one command file is three chances for them to drift;
8
+ * a tail line that dropped a column would be a difference nobody could see
9
+ * without two terminals.
10
+ */
11
+ /** The columns the one-shot and `--invocation` tables share, in order. */
12
+ export declare const FUNCTION_LOG_COLUMNS: readonly ["TIME", "STATUS", "TRIGGER", "RUNTIME", "VERSION", "RUN/INVOCATION ID", "CODE", "ERROR"];
13
+ /**
14
+ * The FIRST error line only — #3287.
15
+ *
16
+ * A stack is eight kilobytes and a table row is one line, so the row says what
17
+ * happened and `--json` carries the rest.
18
+ */
19
+ export declare function firstErrorLine(row: any): string;
20
+ /** The cells one record contributes to a table row. */
21
+ export declare function functionLogCells(row: any): Record<string, string>;
22
+ /**
23
+ * The same record as one line, for `--follow`.
24
+ *
25
+ * Same facts in the same order as the table's columns, so a reader who switches
26
+ * between them is reading the same thing. An absent value contributes nothing
27
+ * rather than an empty gap, because a tail line has no columns to keep aligned.
28
+ */
29
+ export declare function functionLogLine(row: any): string;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * One invocation, as a human reads it — the columns and the tail line.
3
+ *
4
+ * Extracted from `commands/functions.ts` by #3462 so the VERSION it added has
5
+ * somewhere to be tested. The one-shot table, the `--invocation` point read and
6
+ * the `--follow` tail all render the same facts in the same order, and three
7
+ * copies of that order in one command file is three chances for them to drift;
8
+ * a tail line that dropped a column would be a difference nobody could see
9
+ * without two terminals.
10
+ */
11
+ /** The columns the one-shot and `--invocation` tables share, in order. */
12
+ export const FUNCTION_LOG_COLUMNS = [
13
+ "TIME",
14
+ "STATUS",
15
+ "TRIGGER",
16
+ // #3482 — which RUNTIME the platform ran this invocation under, beside the
17
+ // DOOR that fired it. `ctx.trigger.kind` says which door; this says whether
18
+ // the platform ran the code inside the request or as a task run, which is
19
+ // what `assertRuntime` tests for and what the two budgets differ by. Blank
20
+ // for a record written before the column existed.
21
+ "RUNTIME",
22
+ // #3462 — WHICH version this invocation executed. The record has carried
23
+ // `configId` since #3287 and nothing rendered it.
24
+ "VERSION",
25
+ "RUN/INVOCATION ID",
26
+ "CODE",
27
+ "ERROR",
28
+ ];
29
+ /**
30
+ * The FIRST error line only — #3287.
31
+ *
32
+ * A stack is eight kilobytes and a table row is one line, so the row says what
33
+ * happened and `--json` carries the rest.
34
+ */
35
+ export function firstErrorLine(row) {
36
+ const message = String(row?.errorMessage ?? "").trim();
37
+ if (message)
38
+ return message.split("\n")[0];
39
+ const stderr = Array.isArray(row?.stderr) ? row.stderr : [];
40
+ return stderr.length > 0 ? String(stderr[0].line ?? "") : "";
41
+ }
42
+ /** The cells one record contributes to a table row. */
43
+ export function functionLogCells(row) {
44
+ return {
45
+ startedAt: row?.startedAt ?? "",
46
+ status: row?.status ?? "",
47
+ trigger: row?.trigger?.kind ?? "",
48
+ runtime: row?.runtime ?? "",
49
+ configId: row?.configId ?? "",
50
+ // A trigger fire and a task run name their run; a request invocation's key
51
+ // is its own id.
52
+ runOrInvocation: row?.runId || row?.invocationId || "",
53
+ errorCode: row?.errorCode ?? "",
54
+ firstError: firstErrorLine(row),
55
+ };
56
+ }
57
+ /**
58
+ * The same record as one line, for `--follow`.
59
+ *
60
+ * Same facts in the same order as the table's columns, so a reader who switches
61
+ * between them is reading the same thing. An absent value contributes nothing
62
+ * rather than an empty gap, because a tail line has no columns to keep aligned.
63
+ */
64
+ export function functionLogLine(row) {
65
+ const cells = functionLogCells(row);
66
+ const runtime = cells.runtime ? ` ${cells.runtime}` : "";
67
+ const version = cells.configId ? ` ${cells.configId}` : "";
68
+ const code = cells.errorCode ? ` ${cells.errorCode}` : "";
69
+ const detail = cells.firstError ? ` ${cells.firstError}` : "";
70
+ return (`${cells.startedAt} ${cells.status} ${cells.trigger}${runtime}${version} ` +
71
+ `${cells.runOrInvocation}${code}${detail}`);
72
+ }
73
+ //# sourceMappingURL=function-log-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-log-row.js","sourceRoot":"","sources":["../../../src/lib/function-log-row.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,QAAQ;IACR,SAAS;IACT,2EAA2E;IAC3E,4EAA4E;IAC5E,0EAA0E;IAC1E,2EAA2E;IAC3E,kDAAkD;IAClD,SAAS;IACT,yEAAyE;IACzE,kDAAkD;IAClD,SAAS;IACT,mBAAmB;IACnB,MAAM;IACN,OAAO;CACC,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,cAAc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,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,OAAO,CACL,GAAG,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,IAAI;QAC7E,GAAG,KAAK,CAAC,eAAe,GAAG,IAAI,GAAG,MAAM,EAAE,CAC3C,CAAC;AACJ,CAAC"}
@@ -65,19 +65,68 @@ export interface LogTailOptions<T> {
65
65
  * uninitialized tail.
66
66
  */
67
67
  export declare const EMPTY_TAIL_MARK = "0";
68
+ /**
69
+ * How far below the mark the walk still looks — #3448 D3448-013.
70
+ *
71
+ * #3448 mints an invocation's id BEFORE the run and writes its record at
72
+ * SETTLEMENT, so a record can be inserted BELOW a mark set while it was still
73
+ * running: A starts, B starts and settles and is emitted, A settles. Under
74
+ * `stop at id <= mark` A is never shown — and A is the slow, failed and
75
+ * timed-out invocation an operator tails for (D3448-SO-003).
76
+ *
77
+ * The bound is the longest a REQUEST record can lag its own id: the platform's
78
+ * 30 s request ceiling plus the token's skew grace, rounded up to a minute.
79
+ * Nothing below it can still be in flight, so a row older than the window is
80
+ * already settled and was already emitted or already skipped.
81
+ *
82
+ * A task run's slice records carry settle-time ids of their own and are
83
+ * unaffected — they were never out of order.
84
+ */
85
+ export declare const TAIL_OVERLAP_MS = 60000;
86
+ /**
87
+ * The id the walk stops below, given the mark.
88
+ *
89
+ * A mark this cannot read — the empty sentinel, or a fixture's short id — is
90
+ * its own bound: there is no instant to widen from, so the walk stops exactly
91
+ * where it stopped before this change, and #3287's own fixtures are unmoved.
92
+ */
93
+ export declare function tailLowerBound(mark: string): string;
68
94
  /** What the checkpoint string carries. */
69
95
  interface TailCheckpoint {
70
96
  /** The newest id already emitted (or the empty sentinel). */
71
97
  mark: string;
72
98
  /** Set while a walk toward `mark` is in progress: the page to resume at. */
73
99
  cursor?: string;
100
+ /**
101
+ * The ids already emitted that still lie inside the overlap window — #3448.
102
+ *
103
+ * The walk now revisits rows at or below the mark, and this is what makes a
104
+ * row in the overlap emitted ONCE. It is pruned as the window slides, so it
105
+ * is bounded by what a minute can hold rather than by the tail's lifetime.
106
+ */
107
+ seen: string[];
108
+ /**
109
+ * The oldest id the bootstrap managed to read, when it could not reach the
110
+ * whole overlap window inside its page budget — CR3448-003.
111
+ *
112
+ * The walk must not go below it: rows under it existed BEFORE the tail
113
+ * started and the baseline never recorded them, so reaching them would print
114
+ * history as if it were arriving. It is dropped as soon as the mark has
115
+ * moved far enough that the window itself is the tighter bound.
116
+ */
117
+ floor?: string;
74
118
  }
75
119
  /**
76
120
  * A bare mark stays a bare mark — the common case, and what an operator sees
77
- * in a debug print. A walk in progress is JSON, which a ULID cannot start
78
- * with, so the two are told apart by their first character.
121
+ * in a debug print. Anything more is JSON, which a ULID cannot start with, so
122
+ * the two are told apart by their first character.
79
123
  */
80
124
  export declare function encodeTailCheckpoint(checkpoint: TailCheckpoint): string;
125
+ /**
126
+ * A pre-#3448 checkpoint has no `seen` key and reads as an empty set, which is
127
+ * the honest answer: the tail that wrote it never looked below its mark, so it
128
+ * emitted nothing inside the window it needs to remember.
129
+ */
81
130
  export declare function decodeTailCheckpoint(token: string): TailCheckpoint;
82
131
  export declare function buildLogFollowSource<T>(fetchPage: LogPager<T>, options: LogTailOptions<T>): FollowSource<T>;
83
132
  export {};