@promptbook/cli 0.114.0-35 → 0.114.0-39

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 (86) hide show
  1. package/agents/default/.core/adam.book +33 -0
  2. package/apps/agents-server/package.json +1 -1
  3. package/apps/agents-server/scripts/build-agents-server.js +4 -0
  4. package/apps/agents-server/scripts/build-e2e.js +1 -1
  5. package/apps/agents-server/src/app/swagger/SwaggerPageClient.tsx +35 -19
  6. package/apps/agents-server/src/types/swagger-ui-dist.d.ts +5 -0
  7. package/apps/agents-server/src/utils/agentReferenceResolver/AgentReferenceResolutionIssue.ts +1 -69
  8. package/apps/agents-server/src/utils/agentReferenceResolver/extractAgentReferenceTokens.ts +1 -61
  9. package/apps/agents-server/src/utils/explicitFromCommitment.ts +1 -130
  10. package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +32 -817
  11. package/esm/index.es.js +1431 -128
  12. package/esm/index.es.js.map +1 -1
  13. package/esm/scripts/run-agent-messages/messages/createAgentRunnerSystemMessage.d.ts +2 -1
  14. package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +11 -0
  15. package/esm/scripts/run-codex-prompts/git/commitInitializedAgentBooks.d.ts +5 -0
  16. package/esm/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +5 -8
  17. package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -4
  18. package/esm/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -17
  19. package/esm/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +3 -15
  20. package/esm/scripts/run-codex-prompts/prompts/formatRunnerSignature.d.ts +14 -1
  21. package/esm/scripts/run-codex-prompts/prompts/markPromptFailed.d.ts +2 -9
  22. package/esm/src/book-2.0/agent-source/AgentReferenceResolutionIssue.d.ts +45 -0
  23. package/esm/src/book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts +1 -0
  24. package/esm/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
  25. package/esm/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
  26. package/esm/src/book-2.0/agent-source/explicitFromCommitment.d.ts +62 -0
  27. package/esm/src/book-2.0/agent-source/extractAgentReferenceTokens.d.ts +32 -0
  28. package/esm/src/book-2.0/agent-source/resolveInheritedAgentSource.d.ts +73 -0
  29. package/esm/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
  30. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +1 -0
  31. package/esm/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +46 -0
  32. package/esm/src/cli/cli-commands/common/createLocalAgentReferenceResolver.d.ts +8 -0
  33. package/esm/src/cli/cli-commands/common/ensureAdamAgentBook.d.ts +12 -0
  34. package/esm/src/cli/cli-commands/common/resolveBundledAgentBookPath.d.ts +6 -0
  35. package/esm/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +19 -0
  36. package/esm/src/version.d.ts +1 -1
  37. package/package.json +2 -3
  38. package/src/book-2.0/agent-source/AgentReferenceResolutionIssue.ts +75 -0
  39. package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.ts +3 -2
  40. package/src/book-2.0/agent-source/deduplicateSystemMessage.ts +327 -0
  41. package/src/book-2.0/agent-source/explicitFromCommitment.ts +132 -0
  42. package/src/book-2.0/agent-source/extractAgentReferenceTokens.ts +65 -0
  43. package/src/book-2.0/agent-source/resolveInheritedAgentSource.ts +841 -0
  44. package/src/cli/$initializePromptbookCliProgram.ts +87 -0
  45. package/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.ts +2 -28
  46. package/src/cli/cli-commands/coder/init.ts +3 -1
  47. package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +5 -0
  48. package/src/cli/cli-commands/coder/list.ts +5 -3
  49. package/src/cli/cli-commands/coder/printInitializationSummary.ts +6 -0
  50. package/src/cli/cli-commands/coder/run.ts +4 -1
  51. package/src/cli/cli-commands/coder/server.ts +2 -1
  52. package/src/cli/cli-commands/common/LocalAgentBookCollection.ts +220 -0
  53. package/src/cli/cli-commands/common/createLocalAgentReferenceResolver.ts +62 -0
  54. package/src/cli/cli-commands/common/ensureAdamAgentBook.ts +40 -0
  55. package/src/cli/cli-commands/common/resolveBundledAgentBookPath.ts +38 -0
  56. package/src/cli/cli-commands/common/resolveLocalAgentSource.ts +127 -0
  57. package/src/cli/promptbookCli.ts +2 -87
  58. package/src/other/templates/getTemplatesPipelineCollection.ts +612 -944
  59. package/src/version.ts +2 -2
  60. package/src/versions.txt +4 -0
  61. package/umd/index.umd.js +1431 -128
  62. package/umd/index.umd.js.map +1 -1
  63. package/umd/scripts/run-agent-messages/messages/createAgentRunnerSystemMessage.d.ts +2 -1
  64. package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +11 -0
  65. package/umd/scripts/run-codex-prompts/git/commitInitializedAgentBooks.d.ts +5 -0
  66. package/umd/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +5 -8
  67. package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -4
  68. package/umd/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -17
  69. package/umd/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +3 -15
  70. package/umd/scripts/run-codex-prompts/prompts/formatRunnerSignature.d.ts +14 -1
  71. package/umd/scripts/run-codex-prompts/prompts/markPromptFailed.d.ts +2 -9
  72. package/umd/src/book-2.0/agent-source/AgentReferenceResolutionIssue.d.ts +45 -0
  73. package/umd/src/book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts +1 -0
  74. package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
  75. package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
  76. package/umd/src/book-2.0/agent-source/explicitFromCommitment.d.ts +62 -0
  77. package/umd/src/book-2.0/agent-source/extractAgentReferenceTokens.d.ts +32 -0
  78. package/umd/src/book-2.0/agent-source/resolveInheritedAgentSource.d.ts +73 -0
  79. package/umd/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
  80. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +1 -0
  81. package/umd/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +46 -0
  82. package/umd/src/cli/cli-commands/common/createLocalAgentReferenceResolver.d.ts +8 -0
  83. package/umd/src/cli/cli-commands/common/ensureAdamAgentBook.d.ts +12 -0
  84. package/umd/src/cli/cli-commands/common/resolveBundledAgentBookPath.d.ts +6 -0
  85. package/umd/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +19 -0
  86. package/umd/src/version.d.ts +1 -1
@@ -1,9 +1,10 @@
1
1
  import type { AgentModelRequirements } from '../../../src/book-2.0/agent-source/AgentModelRequirements';
2
+ import type { CreateAgentModelRequirementsOptions } from '../../../src/book-2.0/agent-source/CreateAgentModelRequirementsOptions';
2
3
  import type { string_book } from '../../../src/book-2.0/agent-source/string_book';
3
4
  /**
4
5
  * Compiles agent source into the behavior text passed to CLI harness runners.
5
6
  */
6
- export declare function createAgentRunnerSystemMessage(agentSource: string_book): Promise<string>;
7
+ export declare function createAgentRunnerSystemMessage(agentSource: string_book, options?: CreateAgentModelRequirementsOptions): Promise<string>;
7
8
  /**
8
9
  * Formats prepared model requirements for a text-only CLI harness prompt.
9
10
  */
@@ -7,6 +7,13 @@ export type ResolvedCoderAgentBook = {
7
7
  * Raw source of the agent `.book` file.
8
8
  */
9
9
  readonly agentSource: string_book;
10
+ /**
11
+ * Human-readable name of the agent, as it is reported in prompt status lines and run traces.
12
+ *
13
+ * Comes from the `META FULLNAME` of the Book, or from the plain title on its first line, so it is the
14
+ * display name of the agent and not its normalized identifier.
15
+ */
16
+ readonly agentName: string;
10
17
  /**
11
18
  * Equivalent references by which a prompt may target this agent.
12
19
  *
@@ -19,10 +26,14 @@ export type ResolvedCoderAgentBook = {
19
26
  * Agent data resolved from the optional `--agent` book file.
20
27
  */
21
28
  export type ResolvedCoderAgent = ResolvedCoderAgentBook & {
29
+ /** Source with inheritance and imports applied, also used for the coder's agent visual. */
30
+ readonly agentSource: string_book;
22
31
  /**
23
32
  * Compiled system message injected into each coding prompt.
24
33
  */
25
34
  readonly systemMessage: string;
35
+ /** Books created during resolution, committed according to the coder's normal commit setting. */
36
+ readonly createdAgentBookPaths: ReadonlyArray<string>;
26
37
  };
27
38
  /**
28
39
  * Reads an optional agent `.book` file and prepares the references that route prompts to it.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Commits newly initialized, non-ignored agent books before the coder's clean-tree checkpoint.
3
+ * Only books created by this run are eligible; existing books and unrelated changes remain outside the commit.
4
+ */
5
+ export declare function commitInitializedAgentBooks(projectPath: string, createdAgentBookPaths: ReadonlyArray<string>): Promise<void>;
@@ -1,12 +1,6 @@
1
1
  import type { RunOptions } from '../cli/RunOptions';
2
+ import type { PromptRunnerMetadata } from '../common/PromptRunnerMetadata';
2
3
  import type { PromptRunner } from '../runners/types/PromptRunner';
3
- /**
4
- * Runner metadata used in prompt status lines.
5
- */
6
- type RunnerMetadata = {
7
- runnerName: string;
8
- modelName?: string;
9
- };
10
4
  /**
11
5
  * Subset of `RunOptions` which decides which prompt runner is created and how it is labeled.
12
6
  *
@@ -20,7 +14,10 @@ export type PromptRunnerSelectionOptions = Pick<RunOptions, 'agentName' | 'model
20
14
  type PromptRunnerResolution = {
21
15
  runner: PromptRunner;
22
16
  actualRunnerModel?: string;
23
- runnerMetadata: RunnerMetadata;
17
+ /**
18
+ * Harness half of the run metadata; the optional Book agent is added by the caller which resolves it.
19
+ */
20
+ runnerMetadata: PromptRunnerMetadata;
24
21
  };
25
22
  /**
26
23
  * Resolves the configured prompt runner together with status-line metadata.
@@ -1,6 +1,7 @@
1
1
  import type { RunOptions } from '../cli/RunOptions';
2
2
  import type { CliProgressDisplay } from '../common/cliProgressDisplay';
3
3
  import type { WaitForCoderRunPauseCheckpoint } from '../common/CoderRunPauseCheckpoint';
4
+ import type { PromptRunnerMetadata } from '../common/PromptRunnerMetadata';
4
5
  import type { PromptSelection } from '../prompts/types/PromptSelection';
5
6
  import type { PromptRunner } from '../runners/types/PromptRunner';
6
7
  import type { CoderRunUiHandle } from '../ui/renderCoderRunUi';
@@ -10,10 +11,7 @@ import type { CoderRunUiHandle } from '../ui/renderCoderRunUi';
10
11
  export type RunPromptRoundOptions = {
11
12
  options: RunOptions;
12
13
  runner: PromptRunner;
13
- runnerMetadata: {
14
- runnerName: string;
15
- modelName?: string;
16
- };
14
+ runnerMetadata: PromptRunnerMetadata;
17
15
  nextPrompt: PromptSelection;
18
16
  promptLabel: string;
19
17
  resolvedCoderContext?: string;
@@ -1,7 +1,7 @@
1
1
  import moment from 'moment';
2
2
  import { type CodexLoginMethod } from '../../../src/book-3.0/codexLoginMethod';
3
- import type { ThinkingLevel } from '../../../src/cli/cli-commands/coder/ThinkingLevel';
4
3
  import type { CoderRunStep } from '../common/CoderRunStep';
4
+ import { type FormatRunnerSignatureOptions } from './formatRunnerSignature';
5
5
  import type { PromptFile } from './types/PromptFile';
6
6
  import type { PromptSection } from './types/PromptSection';
7
7
  /**
@@ -29,21 +29,9 @@ export type PromptRunTraceOutcome = {
29
29
  /**
30
30
  * Everything one run trace says about the prompt round it describes.
31
31
  */
32
- export type BuildPromptRunTraceContentOptions = {
32
+ export type BuildPromptRunTraceContentOptions = FormatRunnerSignatureOptions & {
33
33
  readonly file: PromptFile;
34
34
  readonly section: PromptSection;
35
- /**
36
- * Harness which ran the prompt.
37
- */
38
- readonly runnerName?: string;
39
- /**
40
- * Model the harness ran the prompt with.
41
- */
42
- readonly modelName?: string;
43
- /**
44
- * Reasoning effort the harness ran the prompt with.
45
- */
46
- readonly thinkingLevel?: ThinkingLevel;
47
35
  /**
48
36
  * Verification command the round ran after each coding attempt, when one is configured.
49
37
  */
@@ -70,8 +58,8 @@ export type BuildPromptRunTraceContentOptions = {
70
58
  /**
71
59
  * Renders the markdown run trace of one finished or failed prompt round.
72
60
  *
73
- * The trace pairs the metadata of the round - which harness, model and thinking level ran it, how long each of
74
- * its steps took and what it cost - with the untouched runtime log, so a finished round can still be analyzed
75
- * after its temporary artifacts are cleaned up.
61
+ * The trace pairs the metadata of the round - which agent, harness, model and thinking level ran it, how long
62
+ * each of its steps took and what it cost - with the untouched runtime log, so a finished round can still be
63
+ * analyzed after its temporary artifacts are cleaned up.
76
64
  */
77
65
  export declare function buildPromptRunTraceContent(options: BuildPromptRunTraceContentOptions): string;
@@ -1,11 +1,11 @@
1
1
  import { type CodexLoginMethod } from '../../../src/book-3.0/codexLoginMethod';
2
- import type { ThinkingLevel } from '../../../src/cli/cli-commands/coder/ThinkingLevel';
3
2
  import type { CoderRunStep, CoderRunStepKind } from '../common/CoderRunStep';
3
+ import { type FormatRunnerSignatureOptions } from './formatRunnerSignature';
4
4
  import { type PromptRunnerAttribution } from './promptRunnerAttribution';
5
5
  /**
6
6
  * Everything one prompt status line says after its checklist marker.
7
7
  */
8
- export type BuildPromptStatusDetailsOptions = {
8
+ export type BuildPromptStatusDetailsOptions = FormatRunnerSignatureOptions & {
9
9
  /**
10
10
  * Steps of the prompt round which have already finished, each with its own price and duration.
11
11
  */
@@ -14,14 +14,6 @@ export type BuildPromptStatusDetailsOptions = {
14
14
  * Step which has already started but has not finished yet, reported as `Implementation in progress`.
15
15
  */
16
16
  readonly inProgressStepKind?: CoderRunStepKind;
17
- /**
18
- * Harness which runs the prompt.
19
- */
20
- readonly runnerName: string | undefined;
21
- /**
22
- * Model the harness runs the prompt with.
23
- */
24
- readonly modelName: string | undefined;
25
17
  /**
26
18
  * Chronological runner report read from a prompt left in the middle of its implementation.
27
19
  *
@@ -37,15 +29,11 @@ export type BuildPromptStatusDetailsOptions = {
37
29
  * Authentication method the harness reported, when it is already known.
38
30
  */
39
31
  readonly loginMethod?: CodexLoginMethod;
40
- /**
41
- * Reasoning effort the harness runs the prompt with.
42
- */
43
- readonly thinkingLevel?: ThinkingLevel;
44
32
  };
45
33
  /**
46
34
  * Builds the shared body of a prompt status line, used by both the in-progress `[^]` and the done `[x]` status.
47
35
  *
48
36
  * Produces details such as
49
- * ``by OpenAI Codex `gpt-5.6-luna` thinking `max` (ChatGPT account) - Implementation ~$0.2036 10 minutes``.
37
+ * ``by Developer on OpenAI Codex `gpt-5.6-luna` thinking `max` (ChatGPT account) - Implementation ~$0.2036 10 minutes``.
50
38
  */
51
39
  export declare function buildPromptStatusDetails(options: BuildPromptStatusDetailsOptions): string;
@@ -1,5 +1,18 @@
1
1
  import type { ThinkingLevel } from '../../../src/cli/cli-commands/coder/ThinkingLevel';
2
+ import type { PromptRunnerMetadata } from '../common/PromptRunnerMetadata';
3
+ /**
4
+ * Everything one runner signature can name, as far as it is known when the signature is formatted.
5
+ */
6
+ export type FormatRunnerSignatureOptions = Partial<PromptRunnerMetadata> & {
7
+ /**
8
+ * Reasoning effort the harness runs the prompt with.
9
+ */
10
+ readonly thinkingLevel?: ThinkingLevel;
11
+ };
2
12
  /**
3
13
  * Formats runner details for prompt status lines.
14
+ *
15
+ * Produces `` OpenAI Codex `gpt-5.6-luna` thinking `max` `` for a plain run and
16
+ * `` Developer on OpenAI Codex `gpt-5.6-luna` thinking `max` `` for a run personalized with `--agent`.
4
17
  */
5
- export declare function formatRunnerSignature(runnerName: string | undefined, modelName: string | undefined, thinkingLevel?: ThinkingLevel): string;
18
+ export declare function formatRunnerSignature(options: FormatRunnerSignatureOptions): string;
@@ -1,11 +1,12 @@
1
1
  import moment from 'moment';
2
+ import { type FormatRunnerSignatureOptions } from './formatRunnerSignature';
2
3
  import { type PromptRunnerAttribution } from './promptRunnerAttribution';
3
4
  import type { PromptFile } from './types/PromptFile';
4
5
  import type { PromptSection } from './types/PromptSection';
5
6
  /**
6
7
  * Input for marking one prompt section as failed.
7
8
  */
8
- export type MarkPromptFailedOptions = {
9
+ export type MarkPromptFailedOptions = FormatRunnerSignatureOptions & {
9
10
  /**
10
11
  * Prompt file the marked section belongs to.
11
12
  */
@@ -14,14 +15,6 @@ export type MarkPromptFailedOptions = {
14
15
  * Section which could not be implemented.
15
16
  */
16
17
  readonly section: PromptSection;
17
- /**
18
- * Harness which ran the prompt.
19
- */
20
- readonly runnerName: string | undefined;
21
- /**
22
- * Model the harness ran the prompt with.
23
- */
24
- readonly modelName: string | undefined;
25
18
  /**
26
19
  * Chronological runner report read from a prompt left in the middle of its implementation.
27
20
  */
@@ -0,0 +1,45 @@
1
+ import type { BookCommitment } from '../../commitments/_base/BookCommitment';
2
+ import type { AgentReferenceResolver } from './AgentReferenceResolver';
3
+ /**
4
+ * Structured issue captured when compact agent reference resolution fails.
5
+ *
6
+ * @private internal utility of agent reference resolution
7
+ */
8
+ export type AgentReferenceResolutionIssue = {
9
+ /**
10
+ * Commitment where the unresolved token appeared.
11
+ */
12
+ readonly commitmentType: BookCommitment;
13
+ /**
14
+ * Original token text (for example `{Unknown Agent}` or `@UnknownAgent`).
15
+ */
16
+ readonly token: string;
17
+ /**
18
+ * Normalized token payload used for lookup.
19
+ */
20
+ readonly reference: string;
21
+ /**
22
+ * Human-readable explanation of why the token could not be resolved.
23
+ */
24
+ readonly message: string;
25
+ };
26
+ /**
27
+ * Extension implemented by resolvers that can expose accumulated resolution issues.
28
+ *
29
+ * @private internal utility of agent reference resolution
30
+ */
31
+ export type IssueTrackingAgentReferenceResolver = AgentReferenceResolver & {
32
+ /**
33
+ * Returns tracked issues and clears the internal queue.
34
+ */
35
+ consumeResolutionIssues(): Array<AgentReferenceResolutionIssue>;
36
+ };
37
+ /**
38
+ * Drains unresolved compact-reference issues from a resolver when supported.
39
+ *
40
+ * @param resolver - Resolver instance that may implement issue tracking.
41
+ * @returns Collected issues or an empty list.
42
+ *
43
+ * @private internal utility of agent reference resolution
44
+ */
45
+ export declare function consumeAgentReferenceResolutionIssues(resolver?: AgentReferenceResolver): Array<AgentReferenceResolutionIssue>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Removes duplicated instructions from a generated system message
3
+ *
4
+ * Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
5
+ * section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
6
+ * `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
7
+ * one heading into the position of their first occurrence and keeps every identical block only once.
8
+ *
9
+ * @param systemMessage The assembled system message which may contain repeated sections and blocks
10
+ * @returns The system message where each section heading and each identical block appears exactly once
11
+ *
12
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
13
+ */
14
+ export declare function deduplicateSystemMessage(systemMessage: string): string;
@@ -0,0 +1,62 @@
1
+ import type { string_book } from './string_book';
2
+ /**
3
+ * One explicit `FROM` commitment written in a book.
4
+ *
5
+ * @private utility of Agents Server inheritance resolution
6
+ */
7
+ export type ExplicitFromCommitment = {
8
+ /**
9
+ * Zero-based index of the line the commitment was found on, within the scanned lines.
10
+ */
11
+ readonly lineIndex: number;
12
+ /**
13
+ * Trimmed commitment content, empty string for a blank `FROM`.
14
+ */
15
+ readonly content: string;
16
+ };
17
+ /**
18
+ * Collects every explicit single-line `FROM` commitment of one book.
19
+ *
20
+ * This lightweight parser is intentionally limited to the subset needed by inheritance
21
+ * resolution so it stays safe to bundle into the Next.js proxy path.
22
+ *
23
+ * @param sourceLines - Book source already split into lines.
24
+ * @returns Found `FROM` commitments in source order, empty when the book declares no parent.
25
+ *
26
+ * @private utility of Agents Server inheritance resolution
27
+ */
28
+ export declare function collectExplicitFromCommitments(sourceLines: ReadonlyArray<string>): ReadonlyArray<ExplicitFromCommitment>;
29
+ /**
30
+ * Returns the effective explicit `FROM` commitment of one book.
31
+ *
32
+ * A book may repeat `FROM`, in which case the last one wins and overrides every earlier one.
33
+ *
34
+ * @param agentSource - Raw book source.
35
+ * @returns The last explicit `FROM` commitment, or `undefined` when the book declares no parent.
36
+ *
37
+ * @private utility of Agents Server inheritance resolution
38
+ */
39
+ export declare function getEffectiveExplicitFromCommitment(agentSource: string_book): ExplicitFromCommitment | undefined;
40
+ /**
41
+ * Returns the effective explicit `FROM` commitment content of one book.
42
+ *
43
+ * A book may repeat `FROM`, in which case the last one wins and overrides every earlier one.
44
+ *
45
+ * @param agentSource - Raw book source.
46
+ * @returns Trimmed commitment content, empty string for a blank explicit `FROM`, or `undefined` when `FROM` is absent.
47
+ *
48
+ * @private utility of Agents Server inheritance resolution
49
+ */
50
+ export declare function getExplicitFromCommitmentContent(agentSource: string_book): string | undefined;
51
+ /**
52
+ * Returns true when one book declares no parent at all and therefore implicitly inherits from `@Adam`.
53
+ *
54
+ * Writing no `FROM` commitment is equivalent to writing `FROM @Adam`, so only an explicit
55
+ * `FROM @Null` / `FROM {Void}` turns the inheritance off.
56
+ *
57
+ * @param agentSource - Raw book source.
58
+ * @returns True when the implicit `@Adam` ancestor applies to this book.
59
+ *
60
+ * @private utility of Agents Server inheritance resolution
61
+ */
62
+ export declare function isImplicitAdamInheritance(agentSource: string_book): boolean;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Matched compact agent reference token inside commitment content.
3
+ *
4
+ * @private internal utility of agent reference resolution
5
+ */
6
+ export type AgentReferenceTokenMatch = {
7
+ /**
8
+ * Original token text, for example `{Agent Name}` or `@AgentId`.
9
+ */
10
+ readonly token: string;
11
+ /**
12
+ * Token payload used for lookup.
13
+ */
14
+ readonly reference: string;
15
+ /**
16
+ * Zero-based character offset of `token` in the scanned content.
17
+ */
18
+ readonly index: number;
19
+ /**
20
+ * Length of `token` in characters.
21
+ */
22
+ readonly length: number;
23
+ };
24
+ /**
25
+ * Extracts compact agent-reference tokens from commitment content.
26
+ *
27
+ * @param content - Commitment content to inspect.
28
+ * @returns Matched compact reference tokens.
29
+ *
30
+ * @private internal utility of agent reference resolution
31
+ */
32
+ export declare function extractAgentReferenceTokens(content: string): Array<AgentReferenceTokenMatch>;
@@ -0,0 +1,73 @@
1
+ import type { string_agent_url } from '../../types/string_agent_url';
2
+ import type { string_book } from './string_book';
3
+ import type { AgentReferenceResolver } from './AgentReferenceResolver';
4
+ /**
5
+ * Shared options for resolving one agent source with inheritance and imports applied.
6
+ *
7
+ * @private internal utility of agent source resolution
8
+ */
9
+ export type ResolveInheritedAgentSourceOptions = {
10
+ /** Current recursion depth, forwarded to the source importer. */
11
+ readonly recursionLevel?: number;
12
+ /**
13
+ * The URL of the Adam agent to use as the default ancestor
14
+ *
15
+ * @default 'https://core.ptbk.io/agents/adam'
16
+ */
17
+ readonly adamAgentUrl?: string_agent_url;
18
+ /**
19
+ * Custom resolver used to expand compact agent references.
20
+ */
21
+ readonly agentReferenceResolver?: AgentReferenceResolver;
22
+ /**
23
+ * Canonical URL of the currently resolved agent.
24
+ */
25
+ readonly currentAgentUrl?: string_agent_url;
26
+ /**
27
+ * Additional equivalent URLs that should be treated as the current agent while detecting cycles.
28
+ */
29
+ readonly currentAgentAliases?: ReadonlyArray<string_agent_url>;
30
+ /**
31
+ * Already visited agent URLs in the current resolution stack.
32
+ */
33
+ readonly inheritancePath?: ReadonlyArray<string_agent_url>;
34
+ /**
35
+ * Source importer supplied by the host application.
36
+ */
37
+ readonly agentSourceImporter: AgentSourceImporter;
38
+ };
39
+ /**
40
+ * Context passed to a custom agent source importer.
41
+ *
42
+ * @private internal utility of agent source resolution
43
+ */
44
+ export type AgentSourceImporterContext = {
45
+ /**
46
+ * Commitment that requested the imported source.
47
+ */
48
+ readonly commitmentType: 'FROM' | 'IMPORT';
49
+ /**
50
+ * Import options propagated from the current resolution pass.
51
+ */
52
+ readonly importAgentOptions: {
53
+ readonly recursionLevel?: number;
54
+ readonly inheritancePath?: ReadonlyArray<string_agent_url>;
55
+ };
56
+ };
57
+ /**
58
+ * Loads and recursively resolves one referenced agent using the caller's transport.
59
+ *
60
+ * @private internal utility of agent source resolution
61
+ */
62
+ export type AgentSourceImporter = (agentUrl: string_agent_url, context: AgentSourceImporterContext) => Promise<string_book>;
63
+ /**
64
+ * Resolves agent source with inheritance (FROM commitment)
65
+ *
66
+ * It recursively fetches the parent agent source and merges it with the current source.
67
+ *
68
+ * @param agentSource The initial agent source
69
+ * @returns The resolved agent source with inheritance applied
70
+ *
71
+ * @private internal utility of agent source resolution
72
+ */
73
+ export declare function resolveInheritedAgentSource(agentSource: string_book, options: ResolveInheritedAgentSourceOptions): Promise<string_book>;
@@ -0,0 +1,8 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Registers the CLI commands on a fresh Commander program without parsing arguments or running an action.
4
+ * Tests can configure output and exit handling before registration, so subcommands inherit those settings.
5
+ *
6
+ * @private internal utility of `promptbookCli`
7
+ */
8
+ export declare function $initializePromptbookCliProgram(program: Command): void;
@@ -10,6 +10,7 @@ export type CoderInitializationSummary = {
10
10
  readonly promptsDoneDirectoryStatus: InitializationStatus;
11
11
  readonly promptsTemplatesDirectoryStatus: InitializationStatus;
12
12
  readonly agentsDirectoryStatus: InitializationStatus;
13
+ readonly adamAgentFileStatus: InitializationStatus;
13
14
  readonly envFileStatus: InitializationStatus;
14
15
  readonly gitignoreFileStatus: InitializationStatus;
15
16
  readonly packageJsonFileStatus: InitializationStatus;
@@ -0,0 +1,46 @@
1
+ import type { string_book } from '../../../book-2.0/agent-source/string_book';
2
+ import type { TeammateProfile } from '../../../book-2.0/agent-source/TeammateProfileResolver';
3
+ /**
4
+ * A book's source and identity, retaining its location for nested relative references.
5
+ *
6
+ * @private internal type of CLI agent resolution
7
+ */
8
+ export type LocalAgentBook = {
9
+ readonly url: string;
10
+ readonly filePath?: string;
11
+ readonly source: string_book;
12
+ readonly profile: TeammateProfile;
13
+ };
14
+ /**
15
+ * Reads repository books and indexes their first-line names for CLI reference resolution.
16
+ *
17
+ * @private internal utility of CLI agent resolution
18
+ */
19
+ export declare class LocalAgentBookCollection {
20
+ private readonly agentDirectoryPath;
21
+ private readonly currentWorkingDirectory;
22
+ private readonly booksByUrl;
23
+ private readonly booksByName;
24
+ /** Stable default ancestor selected from the initial repository scan. */
25
+ private adamAgentUrl;
26
+ /** Files initialized by this collection, for the coder's normal commit handling. */
27
+ readonly createdAgentBookPaths: string[];
28
+ /** Creates a collection rooted at the primary book's directory. */
29
+ constructor(agentDirectoryPath: string, currentWorkingDirectory: string);
30
+ /** Discovers nested books, including the hidden `.core` directory. */
31
+ initialize(): Promise<void>;
32
+ /** Identifies the default ancestor without creating an unused book for FROM null/void. */
33
+ getAdamAgentUrl(): string;
34
+ /** Resolves a unique first-line name, refusing ambiguous matches. */
35
+ findByName(name: string): LocalAgentBook;
36
+ /** Resolves a name, a path relative to its declaring book, or a path relative to the CLI cwd. */
37
+ resolveReference(reference: string, declaringBook: LocalAgentBook): Promise<string>;
38
+ /** Reads a local book once, canonicalizing symlinks so aliases cannot bypass cycle detection. */
39
+ readBook(filePath: string): Promise<LocalAgentBook>;
40
+ /** Loads a referenced remote book, while keeping local identifiers entirely inside the collection. */
41
+ getBook(url: string): Promise<LocalAgentBook>;
42
+ /** Adds a book under its normalized first-line name and preserves the display name for TEAM. */
43
+ private registerBook;
44
+ /** Walks real directories in deterministic order without following directory symlink loops. */
45
+ private readDirectory;
46
+ }
@@ -0,0 +1,8 @@
1
+ import type { AgentReferenceResolver } from '../../../book-2.0/agent-source/AgentReferenceResolver';
2
+ import type { LocalAgentBook, LocalAgentBookCollection } from './LocalAgentBookCollection';
3
+ /**
4
+ * Creates a resolver scoped to the book which declares each reference.
5
+ *
6
+ * @private internal utility of CLI agent resolution
7
+ */
8
+ export declare function createLocalAgentReferenceResolver(collection: LocalAgentBookCollection, declaringBook: LocalAgentBook): AgentReferenceResolver;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Adam's location relative to a directory of local agents.
3
+ *
4
+ * @private internal constant of CLI agent initialization
5
+ */
6
+ export declare const ADAM_AGENT_BOOK_RELATIVE_PATH = ".core/adam.book";
7
+ /**
8
+ * Creates the same Adam book used by the Agent Server without overwriting a project-owned book.
9
+ *
10
+ * @private internal utility of CLI agent initialization
11
+ */
12
+ export declare function ensureAdamAgentBook(agentDirectoryPath: string): Promise<'created' | 'unchanged'>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Locates a bundled agent in either the source checkout or the generated CLI package.
3
+ *
4
+ * @private internal utility of CLI agent initialization
5
+ */
6
+ export declare function resolveBundledAgentBookPath(relativeFilePath: string): Promise<string>;
@@ -0,0 +1,19 @@
1
+ import type { AgentReferenceResolver } from '../../../book-2.0/agent-source/AgentReferenceResolver';
2
+ import type { string_book } from '../../../book-2.0/agent-source/string_book';
3
+ /**
4
+ * Resolved source together with the profile resolver used when compiling TEAM commitments.
5
+ *
6
+ * @private internal type of CLI agent resolution
7
+ */
8
+ export type ResolvedLocalAgentSource = {
9
+ readonly agentSource: string_book;
10
+ readonly agentReferenceResolver: AgentReferenceResolver;
11
+ /** Newly created books which the coder may include in its initialization commit. */
12
+ readonly createdAgentBookPaths: ReadonlyArray<string>;
13
+ };
14
+ /**
15
+ * Applies the shared Agent Server inheritance rules to a repository's local and remote books.
16
+ *
17
+ * @private internal utility of CLI agent resolution
18
+ */
19
+ export declare function resolveLocalAgentSource(agentBookPath: string, currentWorkingDirectory: string): Promise<ResolvedLocalAgentSource>;
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.114.0-34`).
18
+ * It follows semantic versioning (e.g., `0.114.0-38`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.114.0-35",
3
+ "version": "0.114.0-39",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -151,7 +151,6 @@
151
151
  "@sentry/nextjs": "^10.57.0",
152
152
  "@types/formidable": "3.4.7",
153
153
  "@types/mailparser": "3.4.6",
154
- "@types/swagger-ui-react": "5.18.0",
155
154
  "@types/turndown": "5.0.6",
156
155
  "@vercel/blob": "1.1.1",
157
156
  "@xmldom/xmldom": "^0.9.10",
@@ -175,7 +174,7 @@
175
174
  "node-gzip": "1.1.2",
176
175
  "nodemailer": "^7.0.13",
177
176
  "qrcode": "1.5.4",
178
- "swagger-ui-react": "5.31.2",
177
+ "swagger-ui-dist": "5.32.15",
179
178
  "turndown": "7.2.4",
180
179
  "type-fest": "4.5.0",
181
180
  "web-push": "^3.6.7",