@shipfox/api-logs-dto 16.0.0 → 20.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.
@@ -1,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 8 files with swc (265.13ms)
2
+ Successfully compiled: 9 files with swc (354.9ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @shipfox/api-logs-dto
2
2
 
3
+ ## 20.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ca7eb23: Adds bounded step-log tail reads with consistent output before and after compaction.
8
+
9
+ ## 17.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - 9f898d9: Replaces the logs-only `LOG_STORAGE_S3_*` base configuration with shared `OBJECT_STORAGE_S3_*` settings, per-consumer prefixes, and optional overrides, and adds encrypted agent-session transcript persistence. Self-hosters must migrate their S3 settings and provide `AGENT_SESSION_ENCRYPTION_KEK`; the DTO packages receive matching major versions for the API package-family release without DTO schema changes.
14
+
3
15
  ## 16.0.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { LOG_STREAM_CLOSED, type LogStreamClosedEvent, type LogsEventMap, logStreamClosedEventSchema, logsEventSchemas, } from './events.js';
2
2
  export { type AppendLogsQueryDto, type AppendLogsResponseDto, appendLogsQuerySchema, appendLogsResponseSchema, type LogRecord, type LogWriterConflictResponseDto, logRecordSchema, logWriterConflictResponseSchema, MAX_RECORD_DATA_BYTES, MAX_RECORD_NAME_BYTES, type OffsetGapResponseDto, offsetGapResponseSchema, parseLogRecordLine, parseRawLogRecordLine, type RawLogRecord, type ReadLogsQueryDto, type ReadLogsResponseDto, rawLogRecordSchema, readLogsQuerySchema, readLogsResponseSchema, SESSION_VIEW_VERSION, type ServerLogRecord, type SessionViewDto, type SessionViewLifecycleRow, type SessionViewMessageRow, type SessionViewRawRow, type SessionViewRow, type SessionViewRowMeta, type SessionViewThinkingRow, type SessionViewToolCallRow, type SessionViewToolResultRow, serverLogRecordSchema, sessionViewLifecycleRowSchema, sessionViewMessageRowSchema, sessionViewRawRowSchema, sessionViewRowMetaSchema, sessionViewRowSchema, sessionViewSchema, sessionViewThinkingRowSchema, sessionViewToolCallRowSchema, sessionViewToolResultRowSchema, } from './schemas/index.js';
3
+ export { DEFAULT_STEP_LOG_TAIL_LINES, MAX_STEP_LOG_TAIL_LINES } from './tail.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,SAAS,EACd,KAAK,4BAA4B,EACjC,eAAe,EACf,+BAA+B,EAC/B,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,6BAA6B,EAC7B,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,SAAS,EACd,KAAK,4BAA4B,EACjC,eAAe,EACf,+BAA+B,EAC/B,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,6BAA6B,EAC7B,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,2BAA2B,EAAE,uBAAuB,EAAC,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { LOG_STREAM_CLOSED, logStreamClosedEventSchema, logsEventSchemas } from './events.js';
2
2
  export { appendLogsQuerySchema, appendLogsResponseSchema, logRecordSchema, logWriterConflictResponseSchema, MAX_RECORD_DATA_BYTES, MAX_RECORD_NAME_BYTES, offsetGapResponseSchema, parseLogRecordLine, parseRawLogRecordLine, rawLogRecordSchema, readLogsQuerySchema, readLogsResponseSchema, SESSION_VIEW_VERSION, serverLogRecordSchema, sessionViewLifecycleRowSchema, sessionViewMessageRowSchema, sessionViewRawRowSchema, sessionViewRowMetaSchema, sessionViewRowSchema, sessionViewSchema, sessionViewThinkingRowSchema, sessionViewToolCallRowSchema, sessionViewToolResultRowSchema } from './schemas/index.js';
3
+ export { DEFAULT_STEP_LOG_TAIL_LINES, MAX_STEP_LOG_TAIL_LINES } from './tail.js';
3
4
 
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n LOG_STREAM_CLOSED,\n type LogStreamClosedEvent,\n type LogsEventMap,\n logStreamClosedEventSchema,\n logsEventSchemas,\n} from './events.js';\nexport {\n type AppendLogsQueryDto,\n type AppendLogsResponseDto,\n appendLogsQuerySchema,\n appendLogsResponseSchema,\n type LogRecord,\n type LogWriterConflictResponseDto,\n logRecordSchema,\n logWriterConflictResponseSchema,\n MAX_RECORD_DATA_BYTES,\n MAX_RECORD_NAME_BYTES,\n type OffsetGapResponseDto,\n offsetGapResponseSchema,\n parseLogRecordLine,\n parseRawLogRecordLine,\n type RawLogRecord,\n type ReadLogsQueryDto,\n type ReadLogsResponseDto,\n rawLogRecordSchema,\n readLogsQuerySchema,\n readLogsResponseSchema,\n SESSION_VIEW_VERSION,\n type ServerLogRecord,\n type SessionViewDto,\n type SessionViewLifecycleRow,\n type SessionViewMessageRow,\n type SessionViewRawRow,\n type SessionViewRow,\n type SessionViewRowMeta,\n type SessionViewThinkingRow,\n type SessionViewToolCallRow,\n type SessionViewToolResultRow,\n serverLogRecordSchema,\n sessionViewLifecycleRowSchema,\n sessionViewMessageRowSchema,\n sessionViewRawRowSchema,\n sessionViewRowMetaSchema,\n sessionViewRowSchema,\n sessionViewSchema,\n sessionViewThinkingRowSchema,\n sessionViewToolCallRowSchema,\n sessionViewToolResultRowSchema,\n} from './schemas/index.js';\n"],"names":["LOG_STREAM_CLOSED","logStreamClosedEventSchema","logsEventSchemas","appendLogsQuerySchema","appendLogsResponseSchema","logRecordSchema","logWriterConflictResponseSchema","MAX_RECORD_DATA_BYTES","MAX_RECORD_NAME_BYTES","offsetGapResponseSchema","parseLogRecordLine","parseRawLogRecordLine","rawLogRecordSchema","readLogsQuerySchema","readLogsResponseSchema","SESSION_VIEW_VERSION","serverLogRecordSchema","sessionViewLifecycleRowSchema","sessionViewMessageRowSchema","sessionViewRawRowSchema","sessionViewRowMetaSchema","sessionViewRowSchema","sessionViewSchema","sessionViewThinkingRowSchema","sessionViewToolCallRowSchema","sessionViewToolResultRowSchema"],"mappings":"AAAA,SACEA,iBAAiB,EAGjBC,0BAA0B,EAC1BC,gBAAgB,QACX,cAAc;AACrB,SAGEC,qBAAqB,EACrBC,wBAAwB,EAGxBC,eAAe,EACfC,+BAA+B,EAC/BC,qBAAqB,EACrBC,qBAAqB,EAErBC,uBAAuB,EACvBC,kBAAkB,EAClBC,qBAAqB,EAIrBC,kBAAkB,EAClBC,mBAAmB,EACnBC,sBAAsB,EACtBC,oBAAoB,EAWpBC,qBAAqB,EACrBC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,uBAAuB,EACvBC,wBAAwB,EACxBC,oBAAoB,EACpBC,iBAAiB,EACjBC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,8BAA8B,QACzB,qBAAqB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n LOG_STREAM_CLOSED,\n type LogStreamClosedEvent,\n type LogsEventMap,\n logStreamClosedEventSchema,\n logsEventSchemas,\n} from './events.js';\nexport {\n type AppendLogsQueryDto,\n type AppendLogsResponseDto,\n appendLogsQuerySchema,\n appendLogsResponseSchema,\n type LogRecord,\n type LogWriterConflictResponseDto,\n logRecordSchema,\n logWriterConflictResponseSchema,\n MAX_RECORD_DATA_BYTES,\n MAX_RECORD_NAME_BYTES,\n type OffsetGapResponseDto,\n offsetGapResponseSchema,\n parseLogRecordLine,\n parseRawLogRecordLine,\n type RawLogRecord,\n type ReadLogsQueryDto,\n type ReadLogsResponseDto,\n rawLogRecordSchema,\n readLogsQuerySchema,\n readLogsResponseSchema,\n SESSION_VIEW_VERSION,\n type ServerLogRecord,\n type SessionViewDto,\n type SessionViewLifecycleRow,\n type SessionViewMessageRow,\n type SessionViewRawRow,\n type SessionViewRow,\n type SessionViewRowMeta,\n type SessionViewThinkingRow,\n type SessionViewToolCallRow,\n type SessionViewToolResultRow,\n serverLogRecordSchema,\n sessionViewLifecycleRowSchema,\n sessionViewMessageRowSchema,\n sessionViewRawRowSchema,\n sessionViewRowMetaSchema,\n sessionViewRowSchema,\n sessionViewSchema,\n sessionViewThinkingRowSchema,\n sessionViewToolCallRowSchema,\n sessionViewToolResultRowSchema,\n} from './schemas/index.js';\nexport {DEFAULT_STEP_LOG_TAIL_LINES, MAX_STEP_LOG_TAIL_LINES} from './tail.js';\n"],"names":["LOG_STREAM_CLOSED","logStreamClosedEventSchema","logsEventSchemas","appendLogsQuerySchema","appendLogsResponseSchema","logRecordSchema","logWriterConflictResponseSchema","MAX_RECORD_DATA_BYTES","MAX_RECORD_NAME_BYTES","offsetGapResponseSchema","parseLogRecordLine","parseRawLogRecordLine","rawLogRecordSchema","readLogsQuerySchema","readLogsResponseSchema","SESSION_VIEW_VERSION","serverLogRecordSchema","sessionViewLifecycleRowSchema","sessionViewMessageRowSchema","sessionViewRawRowSchema","sessionViewRowMetaSchema","sessionViewRowSchema","sessionViewSchema","sessionViewThinkingRowSchema","sessionViewToolCallRowSchema","sessionViewToolResultRowSchema","DEFAULT_STEP_LOG_TAIL_LINES","MAX_STEP_LOG_TAIL_LINES"],"mappings":"AAAA,SACEA,iBAAiB,EAGjBC,0BAA0B,EAC1BC,gBAAgB,QACX,cAAc;AACrB,SAGEC,qBAAqB,EACrBC,wBAAwB,EAGxBC,eAAe,EACfC,+BAA+B,EAC/BC,qBAAqB,EACrBC,qBAAqB,EAErBC,uBAAuB,EACvBC,kBAAkB,EAClBC,qBAAqB,EAIrBC,kBAAkB,EAClBC,mBAAmB,EACnBC,sBAAsB,EACtBC,oBAAoB,EAWpBC,qBAAqB,EACrBC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,uBAAuB,EACvBC,wBAAwB,EACxBC,oBAAoB,EACpBC,iBAAiB,EACjBC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,8BAA8B,QACzB,qBAAqB;AAC5B,SAAQC,2BAA2B,EAAEC,uBAAuB,QAAO,YAAY"}
@@ -1,18 +1,33 @@
1
1
  import { type InterModuleClient } from '@shipfox/inter-module';
2
2
  import { z } from 'zod';
3
+ export { DEFAULT_STEP_LOG_TAIL_LINES, MAX_STEP_LOG_TAIL_LINES } from './tail.js';
3
4
  /**
4
- * Producer-owned Logs commands used by synchronous callers. The only method
5
- * today is the server-origin append for server-executed steps (the tool step
6
- * executor): it writes already-normalized stored records through the same
7
- * offset-CAS and budget pipeline as the lease-bound runner route, but with
8
- * chunk `origin` `server` and a tail-derived CAS offset (the caller owns no
9
- * spool cursor). This is a trusted internal boundary, not an authorization
10
- * boundary: the caller must derive the identity fields from its execution
11
- * context rather than pass through arbitrary external input.
5
+ * Producer-owned Logs commands used by synchronous callers. The exact-attempt tail read and
6
+ * server-origin append for server-executed steps (the tool step executor) run inside this
7
+ * boundary. The append writes already-normalized stored records through the same offset-CAS and
8
+ * budget pipeline as the lease-bound runner route, but with chunk `origin` `server` and a
9
+ * tail-derived CAS offset (the caller owns no spool cursor). This is a trusted internal
10
+ * boundary, not an authorization boundary: callers must derive identity fields from their
11
+ * execution context rather than pass through arbitrary external input.
12
12
  */
13
13
  export declare const logsInterModuleContract: import("@shipfox/inter-module").InterModuleContract<{
14
14
  readonly module: "logs";
15
15
  readonly methods: {
16
+ /** Reads one exact step attempt as bounded rendered text. */
17
+ readStepLogTail: {
18
+ input: z.ZodObject<{
19
+ stepId: z.ZodString;
20
+ attempt: z.ZodNumber;
21
+ tailLines: z.ZodDefault<z.ZodNumber>;
22
+ }, z.core.$strip>;
23
+ output: z.ZodNullable<z.ZodObject<{
24
+ content: z.ZodString;
25
+ totalLines: z.ZodOptional<z.ZodNumber>;
26
+ }, z.core.$strip>>;
27
+ errors: {
28
+ 'compacted-log-unavailable': z.ZodObject<{}, z.core.$strip>;
29
+ };
30
+ };
16
31
  appendServerRecords: {
17
32
  input: z.ZodObject<{
18
33
  jobId: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../src/inter-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAKtB;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB;;;QAGhC,mBAAmB;YACjB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuBL,MAAM;;;;YAcN,MAAM;gBACJ,uBAAuB;gBACvB,qBAAqB;gBACrB,uBAAuB;;;gBACvB,sBAAsB;gBACtB,YAAY;;;;;;EAIlB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../src/inter-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAMtB,OAAO,EAAC,2BAA2B,EAAE,uBAAuB,EAAC,MAAM,WAAW,CAAC;AAE/E;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;;;QAGhC,6DAA6D;QAC7D,eAAe;YACb,KAAK;;;;;YAUL,MAAM;;;;YAMN,MAAM;gBACJ,2BAA2B;;;QAG/B,mBAAmB;YACjB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuBL,MAAM;;;;YAcN,MAAM;gBACJ,uBAAuB;gBACvB,qBAAqB;gBACrB,uBAAuB;;;gBACvB,sBAAsB;gBACtB,YAAY;;;;;;EAIlB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -1,19 +1,34 @@
1
1
  import { defineInterModuleContract } from '@shipfox/inter-module';
2
2
  import { z } from 'zod';
3
3
  import { serverLogRecordSchema } from './schemas/index.js';
4
+ import { DEFAULT_STEP_LOG_TAIL_LINES, MAX_STEP_LOG_TAIL_LINES } from './tail.js';
4
5
  const idSchema = z.string().uuid();
6
+ export { DEFAULT_STEP_LOG_TAIL_LINES, MAX_STEP_LOG_TAIL_LINES } from './tail.js';
5
7
  /**
6
- * Producer-owned Logs commands used by synchronous callers. The only method
7
- * today is the server-origin append for server-executed steps (the tool step
8
- * executor): it writes already-normalized stored records through the same
9
- * offset-CAS and budget pipeline as the lease-bound runner route, but with
10
- * chunk `origin` `server` and a tail-derived CAS offset (the caller owns no
11
- * spool cursor). This is a trusted internal boundary, not an authorization
12
- * boundary: the caller must derive the identity fields from its execution
13
- * context rather than pass through arbitrary external input.
8
+ * Producer-owned Logs commands used by synchronous callers. The exact-attempt tail read and
9
+ * server-origin append for server-executed steps (the tool step executor) run inside this
10
+ * boundary. The append writes already-normalized stored records through the same offset-CAS and
11
+ * budget pipeline as the lease-bound runner route, but with chunk `origin` `server` and a
12
+ * tail-derived CAS offset (the caller owns no spool cursor). This is a trusted internal
13
+ * boundary, not an authorization boundary: callers must derive identity fields from their
14
+ * execution context rather than pass through arbitrary external input.
14
15
  */ export const logsInterModuleContract = defineInterModuleContract({
15
16
  module: 'logs',
16
17
  methods: {
18
+ /** Reads one exact step attempt as bounded rendered text. */ readStepLogTail: {
19
+ input: z.object({
20
+ stepId: idSchema,
21
+ attempt: z.number().int().min(1).max(2_147_483_647),
22
+ tailLines: z.number().int().min(1).max(MAX_STEP_LOG_TAIL_LINES).default(DEFAULT_STEP_LOG_TAIL_LINES)
23
+ }),
24
+ output: z.object({
25
+ content: z.string(),
26
+ totalLines: z.number().int().nonnegative().optional()
27
+ }).nullable(),
28
+ errors: {
29
+ 'compacted-log-unavailable': z.object({})
30
+ }
31
+ },
17
32
  appendServerRecords: {
18
33
  input: z.object({
19
34
  jobId: idSchema,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/inter-module.ts"],"sourcesContent":["import {defineInterModuleContract, type InterModuleClient} from '@shipfox/inter-module';\nimport {z} from 'zod';\nimport {serverLogRecordSchema} from './schemas/index.js';\n\nconst idSchema = z.string().uuid();\n\n/**\n * Producer-owned Logs commands used by synchronous callers. The only method\n * today is the server-origin append for server-executed steps (the tool step\n * executor): it writes already-normalized stored records through the same\n * offset-CAS and budget pipeline as the lease-bound runner route, but with\n * chunk `origin` `server` and a tail-derived CAS offset (the caller owns no\n * spool cursor). This is a trusted internal boundary, not an authorization\n * boundary: the caller must derive the identity fields from its execution\n * context rather than pass through arbitrary external input.\n */\nexport const logsInterModuleContract = defineInterModuleContract({\n module: 'logs',\n methods: {\n appendServerRecords: {\n input: z.object({\n jobId: idSchema,\n workspaceId: idSchema,\n projectId: idSchema,\n workflowRunAttemptId: idSchema,\n stepId: idSchema,\n attempt: z\n .number()\n .int()\n .min(1)\n .max(2_147_483_647)\n .describe('Attempt number of the step this batch belongs to.'),\n /**\n * Already-normalized server-writable stored records (the read union\n * without server-only tombstones), serialized to whole newline-terminated\n * NDJSON lines on ingest. Server-origin records skip the raw-to-stored\n * normalization the runner path applies: they are stored verbatim. Callers should\n * coalesce records into batches up to (but never over) `LOG_APPEND_BODY_LIMIT_BYTES`;\n * an empty batch is reserved for a heartbeat. A server-origin writer owns its stream;\n * it cannot be mixed with a lease-bound runner writer because their byte cursors differ.\n */\n records: z.array(serverLogRecordSchema),\n }),\n output: z.object({\n committedLength: z\n .number()\n .int()\n .min(0)\n .describe(\n 'New server-held byte position of the stream after this batch was applied (the tail the next call continues from).',\n ),\n capped: z\n .boolean()\n .describe(\n 'When true, the per-job log budget is exhausted and further output is dropped.',\n ),\n }),\n errors: {\n 'lease-stream-mismatch': z.object({}),\n 'malformed-log-chunk': z.object({}),\n 'append-body-too-large': z.object({maxBytes: z.number().int().positive()}),\n 'runner-writer-active': z.object({}),\n 'offset-gap': z.object({committedLength: z.number().int().nonnegative()}),\n },\n },\n },\n});\n\nexport type LogsModuleClient = InterModuleClient<typeof logsInterModuleContract>;\n"],"names":["defineInterModuleContract","z","serverLogRecordSchema","idSchema","string","uuid","logsInterModuleContract","module","methods","appendServerRecords","input","object","jobId","workspaceId","projectId","workflowRunAttemptId","stepId","attempt","number","int","min","max","describe","records","array","output","committedLength","capped","boolean","errors","maxBytes","positive","nonnegative"],"mappings":"AAAA,SAAQA,yBAAyB,QAA+B,wBAAwB;AACxF,SAAQC,CAAC,QAAO,MAAM;AACtB,SAAQC,qBAAqB,QAAO,qBAAqB;AAEzD,MAAMC,WAAWF,EAAEG,MAAM,GAAGC,IAAI;AAEhC;;;;;;;;;CASC,GACD,OAAO,MAAMC,0BAA0BN,0BAA0B;IAC/DO,QAAQ;IACRC,SAAS;QACPC,qBAAqB;YACnBC,OAAOT,EAAEU,MAAM,CAAC;gBACdC,OAAOT;gBACPU,aAAaV;gBACbW,WAAWX;gBACXY,sBAAsBZ;gBACtBa,QAAQb;gBACRc,SAAShB,EACNiB,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,eACJC,QAAQ,CAAC;gBACZ;;;;;;;;SAQC,GACDC,SAAStB,EAAEuB,KAAK,CAACtB;YACnB;YACAuB,QAAQxB,EAAEU,MAAM,CAAC;gBACfe,iBAAiBzB,EACdiB,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJE,QAAQ,CACP;gBAEJK,QAAQ1B,EACL2B,OAAO,GACPN,QAAQ,CACP;YAEN;YACAO,QAAQ;gBACN,yBAAyB5B,EAAEU,MAAM,CAAC,CAAC;gBACnC,uBAAuBV,EAAEU,MAAM,CAAC,CAAC;gBACjC,yBAAyBV,EAAEU,MAAM,CAAC;oBAACmB,UAAU7B,EAAEiB,MAAM,GAAGC,GAAG,GAAGY,QAAQ;gBAAE;gBACxE,wBAAwB9B,EAAEU,MAAM,CAAC,CAAC;gBAClC,cAAcV,EAAEU,MAAM,CAAC;oBAACe,iBAAiBzB,EAAEiB,MAAM,GAAGC,GAAG,GAAGa,WAAW;gBAAE;YACzE;QACF;IACF;AACF,GAAG"}
1
+ {"version":3,"sources":["../src/inter-module.ts"],"sourcesContent":["import {defineInterModuleContract, type InterModuleClient} from '@shipfox/inter-module';\nimport {z} from 'zod';\nimport {serverLogRecordSchema} from './schemas/index.js';\nimport {DEFAULT_STEP_LOG_TAIL_LINES, MAX_STEP_LOG_TAIL_LINES} from './tail.js';\n\nconst idSchema = z.string().uuid();\n\nexport {DEFAULT_STEP_LOG_TAIL_LINES, MAX_STEP_LOG_TAIL_LINES} from './tail.js';\n\n/**\n * Producer-owned Logs commands used by synchronous callers. The exact-attempt tail read and\n * server-origin append for server-executed steps (the tool step executor) run inside this\n * boundary. The append writes already-normalized stored records through the same offset-CAS and\n * budget pipeline as the lease-bound runner route, but with chunk `origin` `server` and a\n * tail-derived CAS offset (the caller owns no spool cursor). This is a trusted internal\n * boundary, not an authorization boundary: callers must derive identity fields from their\n * execution context rather than pass through arbitrary external input.\n */\nexport const logsInterModuleContract = defineInterModuleContract({\n module: 'logs',\n methods: {\n /** Reads one exact step attempt as bounded rendered text. */\n readStepLogTail: {\n input: z.object({\n stepId: idSchema,\n attempt: z.number().int().min(1).max(2_147_483_647),\n tailLines: z\n .number()\n .int()\n .min(1)\n .max(MAX_STEP_LOG_TAIL_LINES)\n .default(DEFAULT_STEP_LOG_TAIL_LINES),\n }),\n output: z\n .object({\n content: z.string(),\n totalLines: z.number().int().nonnegative().optional(),\n })\n .nullable(),\n errors: {\n 'compacted-log-unavailable': z.object({}),\n },\n },\n appendServerRecords: {\n input: z.object({\n jobId: idSchema,\n workspaceId: idSchema,\n projectId: idSchema,\n workflowRunAttemptId: idSchema,\n stepId: idSchema,\n attempt: z\n .number()\n .int()\n .min(1)\n .max(2_147_483_647)\n .describe('Attempt number of the step this batch belongs to.'),\n /**\n * Already-normalized server-writable stored records (the read union\n * without server-only tombstones), serialized to whole newline-terminated\n * NDJSON lines on ingest. Server-origin records skip the raw-to-stored\n * normalization the runner path applies: they are stored verbatim. Callers should\n * coalesce records into batches up to (but never over) `LOG_APPEND_BODY_LIMIT_BYTES`;\n * an empty batch is reserved for a heartbeat. A server-origin writer owns its stream;\n * it cannot be mixed with a lease-bound runner writer because their byte cursors differ.\n */\n records: z.array(serverLogRecordSchema),\n }),\n output: z.object({\n committedLength: z\n .number()\n .int()\n .min(0)\n .describe(\n 'New server-held byte position of the stream after this batch was applied (the tail the next call continues from).',\n ),\n capped: z\n .boolean()\n .describe(\n 'When true, the per-job log budget is exhausted and further output is dropped.',\n ),\n }),\n errors: {\n 'lease-stream-mismatch': z.object({}),\n 'malformed-log-chunk': z.object({}),\n 'append-body-too-large': z.object({maxBytes: z.number().int().positive()}),\n 'runner-writer-active': z.object({}),\n 'offset-gap': z.object({committedLength: z.number().int().nonnegative()}),\n },\n },\n },\n});\n\nexport type LogsModuleClient = InterModuleClient<typeof logsInterModuleContract>;\n"],"names":["defineInterModuleContract","z","serverLogRecordSchema","DEFAULT_STEP_LOG_TAIL_LINES","MAX_STEP_LOG_TAIL_LINES","idSchema","string","uuid","logsInterModuleContract","module","methods","readStepLogTail","input","object","stepId","attempt","number","int","min","max","tailLines","default","output","content","totalLines","nonnegative","optional","nullable","errors","appendServerRecords","jobId","workspaceId","projectId","workflowRunAttemptId","describe","records","array","committedLength","capped","boolean","maxBytes","positive"],"mappings":"AAAA,SAAQA,yBAAyB,QAA+B,wBAAwB;AACxF,SAAQC,CAAC,QAAO,MAAM;AACtB,SAAQC,qBAAqB,QAAO,qBAAqB;AACzD,SAAQC,2BAA2B,EAAEC,uBAAuB,QAAO,YAAY;AAE/E,MAAMC,WAAWJ,EAAEK,MAAM,GAAGC,IAAI;AAEhC,SAAQJ,2BAA2B,EAAEC,uBAAuB,QAAO,YAAY;AAE/E;;;;;;;;CAQC,GACD,OAAO,MAAMI,0BAA0BR,0BAA0B;IAC/DS,QAAQ;IACRC,SAAS;QACP,2DAA2D,GAC3DC,iBAAiB;YACfC,OAAOX,EAAEY,MAAM,CAAC;gBACdC,QAAQT;gBACRU,SAASd,EAAEe,MAAM,GAAGC,GAAG,GAAGC,GAAG,CAAC,GAAGC,GAAG,CAAC;gBACrCC,WAAWnB,EACRe,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAACf,yBACJiB,OAAO,CAAClB;YACb;YACAmB,QAAQrB,EACLY,MAAM,CAAC;gBACNU,SAAStB,EAAEK,MAAM;gBACjBkB,YAAYvB,EAAEe,MAAM,GAAGC,GAAG,GAAGQ,WAAW,GAAGC,QAAQ;YACrD,GACCC,QAAQ;YACXC,QAAQ;gBACN,6BAA6B3B,EAAEY,MAAM,CAAC,CAAC;YACzC;QACF;QACAgB,qBAAqB;YACnBjB,OAAOX,EAAEY,MAAM,CAAC;gBACdiB,OAAOzB;gBACP0B,aAAa1B;gBACb2B,WAAW3B;gBACX4B,sBAAsB5B;gBACtBS,QAAQT;gBACRU,SAASd,EACNe,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJC,GAAG,CAAC,eACJe,QAAQ,CAAC;gBACZ;;;;;;;;SAQC,GACDC,SAASlC,EAAEmC,KAAK,CAAClC;YACnB;YACAoB,QAAQrB,EAAEY,MAAM,CAAC;gBACfwB,iBAAiBpC,EACde,MAAM,GACNC,GAAG,GACHC,GAAG,CAAC,GACJgB,QAAQ,CACP;gBAEJI,QAAQrC,EACLsC,OAAO,GACPL,QAAQ,CACP;YAEN;YACAN,QAAQ;gBACN,yBAAyB3B,EAAEY,MAAM,CAAC,CAAC;gBACnC,uBAAuBZ,EAAEY,MAAM,CAAC,CAAC;gBACjC,yBAAyBZ,EAAEY,MAAM,CAAC;oBAAC2B,UAAUvC,EAAEe,MAAM,GAAGC,GAAG,GAAGwB,QAAQ;gBAAE;gBACxE,wBAAwBxC,EAAEY,MAAM,CAAC,CAAC;gBAClC,cAAcZ,EAAEY,MAAM,CAAC;oBAACwB,iBAAiBpC,EAAEe,MAAM,GAAGC,GAAG,GAAGQ,WAAW;gBAAE;YACzE;QACF;IACF;AACF,GAAG"}
package/dist/tail.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /** Default and maximum line windows accepted by the bounded step-log tail operation. */
2
+ export declare const DEFAULT_STEP_LOG_TAIL_LINES = 500;
3
+ export declare const MAX_STEP_LOG_TAIL_LINES = 2000;
4
+ //# sourceMappingURL=tail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../src/tail.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,uBAAuB,OAAQ,CAAC"}
package/dist/tail.js ADDED
@@ -0,0 +1,4 @@
1
+ /** Default and maximum line windows accepted by the bounded step-log tail operation. */ export const DEFAULT_STEP_LOG_TAIL_LINES = 500;
2
+ export const MAX_STEP_LOG_TAIL_LINES = 2_000;
3
+
4
+ //# sourceMappingURL=tail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tail.ts"],"sourcesContent":["/** Default and maximum line windows accepted by the bounded step-log tail operation. */\nexport const DEFAULT_STEP_LOG_TAIL_LINES = 500;\nexport const MAX_STEP_LOG_TAIL_LINES = 2_000;\n"],"names":["DEFAULT_STEP_LOG_TAIL_LINES","MAX_STEP_LOG_TAIL_LINES"],"mappings":"AAAA,sFAAsF,GACtF,OAAO,MAAMA,8BAA8B,IAAI;AAC/C,OAAO,MAAMC,0BAA0B,MAAM"}