@promptbook/remote-server 0.114.0-41 → 0.114.0-47

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 (103) hide show
  1. package/esm/index.es.js +43 -9
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +2 -0
  4. package/esm/src/cli/cli-commands/coder/add.d.ts +16 -0
  5. package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +3 -2
  6. package/esm/src/cli/cli-commands/coder/augmentCoderAgentTeam.d.ts +7 -0
  7. package/esm/src/cli/cli-commands/coder/coderAgentRole.d.ts +16 -0
  8. package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +8 -7
  9. package/esm/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.d.ts +8 -0
  10. package/esm/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.test.d.ts +1 -0
  11. package/esm/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.d.ts +12 -0
  12. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
  13. package/esm/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.d.ts +9 -0
  14. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +7 -5
  15. package/esm/src/cli/cli-commands/coder/plan.d.ts +7 -0
  16. package/esm/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.d.ts +6 -0
  17. package/esm/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.d.ts +7 -0
  18. package/esm/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.d.ts +6 -0
  19. package/esm/src/cli/cli-commands/coder/planning/createPlanningTerminal.d.ts +8 -0
  20. package/esm/src/cli/cli-commands/coder/planning/createPlanningTerminal.test.d.ts +1 -0
  21. package/esm/src/cli/cli-commands/coder/planning/createPlanningWorkspace.d.ts +11 -0
  22. package/esm/src/cli/cli-commands/coder/planning/discussPlanningTurn.d.ts +15 -0
  23. package/esm/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.d.ts +5 -0
  24. package/esm/src/cli/cli-commands/coder/planning/planningGitSync.test.d.ts +1 -0
  25. package/esm/src/cli/cli-commands/coder/planning/planningPackagedCli.test.d.ts +1 -0
  26. package/esm/src/cli/cli-commands/coder/planning/planningProtocol.d.ts +152 -0
  27. package/esm/src/cli/cli-commands/coder/planning/planningTeam.test.d.ts +1 -0
  28. package/esm/src/cli/cli-commands/coder/planning/preparePlanningChanges.d.ts +16 -0
  29. package/esm/src/cli/cli-commands/coder/planning/readPlanningContext.d.ts +6 -0
  30. package/esm/src/cli/cli-commands/coder/planning/resolvePlanningPath.d.ts +7 -0
  31. package/esm/src/cli/cli-commands/coder/planning/runPlanningHarness.d.ts +30 -0
  32. package/esm/src/cli/cli-commands/coder/planning/runPlanningHarness.test.d.ts +1 -0
  33. package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +21 -0
  34. package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.test.d.ts +1 -0
  35. package/esm/src/cli/cli-commands/coder/planning/savePlanningChanges.d.ts +7 -0
  36. package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +2 -1
  37. package/esm/src/cli/cli-commands/coder/promptsReadmeTemplate.d.ts +13 -0
  38. package/esm/src/cli/cli-commands/coder/promptsReadmeTemplate.test.d.ts +1 -0
  39. package/esm/src/cli/cli-commands/coder/readCoderAgentBook.d.ts +8 -0
  40. package/esm/src/cli/cli-commands/coder/workspacePreflight.test.d.ts +1 -0
  41. package/esm/src/cli/cli-commands/coder.d.ts +1 -0
  42. package/esm/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +4 -2
  43. package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +1 -1
  44. package/esm/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +8 -1
  45. package/esm/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +6 -0
  46. package/esm/src/cli/cli-commands/common/workspaceRepository.d.ts +36 -0
  47. package/esm/src/cli/cli-commands/common/workspaceRepository.test.d.ts +1 -0
  48. package/esm/src/cli/cli-commands/common/workspaceRepositoryCliOptions.d.ts +11 -0
  49. package/esm/src/commitments/TEAM/TEAM.test.d.ts +1 -0
  50. package/esm/src/conversion/archive/loadJsZipModule.d.ts +10 -0
  51. package/esm/src/version.d.ts +1 -1
  52. package/package.json +2 -2
  53. package/umd/index.umd.js +43 -9
  54. package/umd/index.umd.js.map +1 -1
  55. package/umd/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +2 -0
  56. package/umd/src/cli/cli-commands/coder/add.d.ts +16 -0
  57. package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +3 -2
  58. package/umd/src/cli/cli-commands/coder/augmentCoderAgentTeam.d.ts +7 -0
  59. package/umd/src/cli/cli-commands/coder/coderAgentRole.d.ts +16 -0
  60. package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +8 -7
  61. package/umd/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.d.ts +8 -0
  62. package/umd/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.test.d.ts +1 -0
  63. package/umd/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.d.ts +12 -0
  64. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
  65. package/umd/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.d.ts +9 -0
  66. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +7 -5
  67. package/umd/src/cli/cli-commands/coder/plan.d.ts +7 -0
  68. package/umd/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.d.ts +6 -0
  69. package/umd/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.d.ts +7 -0
  70. package/umd/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.d.ts +6 -0
  71. package/umd/src/cli/cli-commands/coder/planning/createPlanningTerminal.d.ts +8 -0
  72. package/umd/src/cli/cli-commands/coder/planning/createPlanningTerminal.test.d.ts +1 -0
  73. package/umd/src/cli/cli-commands/coder/planning/createPlanningWorkspace.d.ts +11 -0
  74. package/umd/src/cli/cli-commands/coder/planning/discussPlanningTurn.d.ts +15 -0
  75. package/umd/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.d.ts +5 -0
  76. package/umd/src/cli/cli-commands/coder/planning/planningGitSync.test.d.ts +1 -0
  77. package/umd/src/cli/cli-commands/coder/planning/planningPackagedCli.test.d.ts +1 -0
  78. package/umd/src/cli/cli-commands/coder/planning/planningProtocol.d.ts +152 -0
  79. package/umd/src/cli/cli-commands/coder/planning/planningTeam.test.d.ts +1 -0
  80. package/umd/src/cli/cli-commands/coder/planning/preparePlanningChanges.d.ts +16 -0
  81. package/umd/src/cli/cli-commands/coder/planning/readPlanningContext.d.ts +6 -0
  82. package/umd/src/cli/cli-commands/coder/planning/resolvePlanningPath.d.ts +7 -0
  83. package/umd/src/cli/cli-commands/coder/planning/runPlanningHarness.d.ts +30 -0
  84. package/umd/src/cli/cli-commands/coder/planning/runPlanningHarness.test.d.ts +1 -0
  85. package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +21 -0
  86. package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.test.d.ts +1 -0
  87. package/umd/src/cli/cli-commands/coder/planning/savePlanningChanges.d.ts +7 -0
  88. package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +2 -1
  89. package/umd/src/cli/cli-commands/coder/promptsReadmeTemplate.d.ts +13 -0
  90. package/umd/src/cli/cli-commands/coder/promptsReadmeTemplate.test.d.ts +1 -0
  91. package/umd/src/cli/cli-commands/coder/readCoderAgentBook.d.ts +8 -0
  92. package/umd/src/cli/cli-commands/coder/workspacePreflight.test.d.ts +1 -0
  93. package/umd/src/cli/cli-commands/coder.d.ts +1 -0
  94. package/umd/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +4 -2
  95. package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +1 -1
  96. package/umd/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +8 -1
  97. package/umd/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +6 -0
  98. package/umd/src/cli/cli-commands/common/workspaceRepository.d.ts +36 -0
  99. package/umd/src/cli/cli-commands/common/workspaceRepository.test.d.ts +1 -0
  100. package/umd/src/cli/cli-commands/common/workspaceRepositoryCliOptions.d.ts +11 -0
  101. package/umd/src/commitments/TEAM/TEAM.test.d.ts +1 -0
  102. package/umd/src/conversion/archive/loadJsZipModule.d.ts +10 -0
  103. package/umd/src/version.d.ts +1 -1
@@ -21,7 +21,7 @@ export declare const CODER_GIT_SYNC_DESCRIPTION: string;
21
21
  * Registers the shared `--commit`, `--auto-push` and `--auto-pull` flags on a `ptbk coder` command.
22
22
  *
23
23
  * Note: Unlike `ptbk coder run`, which commits by default and opts out through `--no-commit`,
24
- * these commands never touch git unless the flags are used explicitly.
24
+ * these commands only mutate Git when the flags are used explicitly. Workspace detection always runs.
25
25
  *
26
26
  * @private internal utility of `promptbookCli`
27
27
  */
@@ -6,8 +6,12 @@ import type { string_book } from '../../../book-2.0/agent-source/string_book';
6
6
  * @private internal type of CLI agent resolution
7
7
  */
8
8
  export type ResolvedLocalAgentSource = {
9
+ /** Canonical identity used to bound recursive TEAM consultations. */
10
+ readonly agentUrl: string;
9
11
  readonly agentSource: string_book;
10
12
  readonly agentReferenceResolver: AgentReferenceResolver;
13
+ /** Resolves another Book in this collection, retaining its own inheritance and reference locations. */
14
+ readonly resolveAgentSource: (url: string, signal?: AbortSignal) => Promise<ResolvedLocalAgentSource>;
11
15
  /** Newly created books which the coder may include in its initialization commit. */
12
16
  readonly createdAgentBookPaths: ReadonlyArray<string>;
13
17
  };
@@ -16,4 +20,7 @@ export type ResolvedLocalAgentSource = {
16
20
  *
17
21
  * @private internal utility of CLI agent resolution
18
22
  */
19
- export declare function resolveLocalAgentSource(agentBookPath: string, currentWorkingDirectory: string): Promise<ResolvedLocalAgentSource>;
23
+ export declare function resolveLocalAgentSource(agentBookPath: string, currentWorkingDirectory: string, options?: {
24
+ readonly isInitializationAllowed?: boolean;
25
+ readonly signal?: AbortSignal;
26
+ }): Promise<ResolvedLocalAgentSource>;
@@ -0,0 +1,6 @@
1
+ import type { RunOptions } from '../../../../scripts/run-codex-prompts/cli/RunOptions';
2
+ /**
3
+ * Validates cross-flag constraints before workspace setup or the run starts.
4
+ * @private shared validation for Coder execution commands
5
+ */
6
+ export declare function validateCoderRunOptions(options: RunOptions): void;
@@ -0,0 +1,36 @@
1
+ import type { NormalizedQuestionsCliOptions } from './questionsCliOptions';
2
+ /**
3
+ * Resolved project directory and its enclosing working tree. Project artifacts belong to `projectPath`;
4
+ * Git paths and synchronization belong to `repositoryRoot`, which may be an enclosing monorepo.
5
+ *
6
+ * @private shared workspace context for Coder and workspace server commands
7
+ */
8
+ export type WorkspaceRepositoryContext = {
9
+ readonly projectPath: string;
10
+ readonly repositoryRoot?: string;
11
+ readonly gitDirectory?: string;
12
+ readonly repositoryStatus: 'missing' | 'reused' | 'initialized';
13
+ };
14
+ /**
15
+ * Command policy is separate from discovery: previews never initialize; explicit init needs no confirmation.
16
+ *
17
+ * @private shared workspace policy for Coder and workspace server commands
18
+ */
19
+ export type WorkspaceRepositoryPolicy = 'initialize' | 'mutate' | 'read-only';
20
+ /**
21
+ * Resolves the requested project once and discovers Git using Git itself, without requiring `HEAD`.
22
+ * Broken metadata, bare repositories, ownership errors and unavailable Git are failures, not missing repositories.
23
+ *
24
+ * @private shared workspace discovery for CLI commands
25
+ */
26
+ export declare function $resolveWorkspaceRepository(projectDirectory?: string): Promise<WorkspaceRepositoryContext>;
27
+ /**
28
+ * Checks the shared prerequisite before any project writes, Git synchronization, installation or startup.
29
+ * Only an affirmative interactive answer or an explicit initializer authorizes `git init`.
30
+ *
31
+ * @private shared workspace preflight for Coder and workspace server commands
32
+ */
33
+ export declare function $preflightWorkspaceRepository(options: {
34
+ readonly projectDirectory?: string;
35
+ readonly policy: WorkspaceRepositoryPolicy;
36
+ } & Partial<NormalizedQuestionsCliOptions>): Promise<WorkspaceRepositoryContext>;
@@ -0,0 +1,11 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Shared explanation of the workspace prerequisite, independent of commit and synchronization settings.
4
+ * @private internal CLI help text
5
+ */
6
+ export declare const WORKSPACE_REPOSITORY_DESCRIPTION: string;
7
+ /**
8
+ * Adds shared Git help and the questions switch to every workspace command without duplicating existing options.
9
+ * @private internal registration helper for workspace CLI commands
10
+ */
11
+ export declare function addWorkspaceRepositoryOptions(command: Command): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Loads the ZIP archive library (`jszip`) on demand
3
+ *
4
+ * Note: [🐌] Loaded lazily to keep the startup of the `ptbk` CLI utility fast
5
+ *
6
+ * @private internal utility of `loadArchive` and `saveArchive`
7
+ */
8
+ export declare const loadJsZipModule: () => Promise<{
9
+ default: typeof import('jszip');
10
+ }>;
@@ -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-40`).
18
+ * It follows semantic versioning (e.g., `0.114.0-47`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.114.0-41",
3
+ "version": "0.114.0-47",
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,
@@ -96,7 +96,7 @@
96
96
  "types": "./esm/src/_packages/remote-server.index.d.ts",
97
97
  "typings": "./esm/src/_packages/remote-server.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.114.0-41"
99
+ "@promptbook/core": "0.114.0-47"
100
100
  },
101
101
  "dependencies": {
102
102
  "@openai/agents": "0.4.15",
package/umd/index.umd.js CHANGED
@@ -50,7 +50,7 @@
50
50
  * @generated
51
51
  * @see https://github.com/webgptorg/promptbook
52
52
  */
53
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-41';
53
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-47';
54
54
  /**
55
55
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
56
56
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -20231,6 +20231,18 @@
20231
20231
 
20232
20232
  Registers teammate agents that the current agent can consult via tools.
20233
20233
 
20234
+ The primary agent sends a question and relevant context to a teammate and receives an attributed answer.
20235
+ Each teammate uses its own Book. Declaring a team makes advisers available when relevant; it does not
20236
+ merge their rules into the primary agent or start every teammate automatically.
20237
+
20238
+ In \`ptbk coder run\` and \`ptbk coder plan\`, TEAM entries in the selected Book, its ancestors and imports
20239
+ use the existing reference rules: \`@Name\`, \`{Agent Name}\`, \`{./lawyer.book}\`, project paths such as
20240
+ \`{agents/lawyer.book}\`, and HTTP(S) Book URLs. Local advisers require no Agents Server. A remote Book
20241
+ must be readable through its normal endpoint; private or inaccessible sources return errors.
20242
+ Coding harnesses expose scoped command tools; planning uses restricted host tools and currently requires
20243
+ OpenAI Codex. Planning restrictions apply to every adviser, including custom Developer Books.
20244
+ The primary agent retains responsibility for the task, PRD proposals and final output.
20245
+
20234
20246
  ## Examples
20235
20247
 
20236
20248
  \`\`\`book
@@ -20242,7 +20254,7 @@
20242
20254
  `);
20243
20255
  }
20244
20256
  applyToAgentModelRequirements(requirements, content) {
20245
- var _a, _b, _c;
20257
+ var _a, _b, _c, _d;
20246
20258
  const trimmedContent = content.trim();
20247
20259
  if (!trimmedContent) {
20248
20260
  return requirements;
@@ -20256,20 +20268,30 @@
20256
20268
  const existingTeammates = ((_b = requirements._metadata) === null || _b === void 0 ? void 0 : _b.teammates) || [];
20257
20269
  const preResolvedProfiles = (((_c = requirements._metadata) === null || _c === void 0 ? void 0 : _c.preResolvedTeammateProfiles) || {});
20258
20270
  const resolvedTeammates = resolveTeamTeammateLabels(trimmedContent, teammates);
20271
+ const toolUrls = new Map(existingTeammates.map((teammate) => [teammate.toolName, teammate.url]));
20259
20272
  const teamEntries = resolvedTeammates.map((teammate) => {
20260
20273
  const profile = preResolvedProfiles[teammate.url];
20261
20274
  const resolvedLabel = (profile === null || profile === void 0 ? void 0 : profile.agentName) || teammate.label;
20262
20275
  const existingTeammate = existingTeammates.find((entry) => entry.url === teammate.url);
20276
+ const baseToolName = (existingTeammate === null || existingTeammate === void 0 ? void 0 : existingTeammate.toolName) || createTeamToolName(teammate.url, resolvedLabel);
20277
+ let toolName = baseToolName;
20278
+ let suffix = 1;
20279
+ // Explicit paths can identify distinct Books with the same display name or normalized label.
20280
+ while (toolUrls.has(toolName) && toolUrls.get(toolName) !== teammate.url) {
20281
+ toolName = `${baseToolName}_${++suffix}`;
20282
+ }
20283
+ toolUrls.set(toolName, teammate.url);
20263
20284
  return {
20264
- toolName: ((existingTeammate === null || existingTeammate === void 0 ? void 0 : existingTeammate.toolName) ||
20265
- createTeamToolName(teammate.url, resolvedLabel)),
20285
+ toolName: toolName,
20266
20286
  teammate: { ...teammate, label: resolvedLabel },
20267
20287
  agentName,
20268
20288
  description: (profile === null || profile === void 0 ? void 0 : profile.personaDescription) || null,
20269
20289
  };
20270
20290
  });
20271
- for (const entry of teamEntries) {
20272
- registerTeamTool(entry);
20291
+ if (!((_d = requirements._metadata) === null || _d === void 0 ? void 0 : _d.isTeamToolRegistrationDisabled)) {
20292
+ for (const entry of teamEntries) {
20293
+ registerTeamTool(entry);
20294
+ }
20273
20295
  }
20274
20296
  const existingTools = requirements.tools || [];
20275
20297
  const updatedTools = [...existingTools];
@@ -30457,9 +30479,15 @@
30457
30479
  if (preResolvedTeammateProfiles[teammate.url]) {
30458
30480
  continue;
30459
30481
  }
30460
- const profile = await profileResolver.resolveTeammateProfile(teammate.url);
30461
- if (profile) {
30462
- preResolvedTeammateProfiles[teammate.url] = profile;
30482
+ try {
30483
+ const profile = await profileResolver.resolveTeammateProfile(teammate.url);
30484
+ if (profile) {
30485
+ preResolvedTeammateProfiles[teammate.url] = profile;
30486
+ }
30487
+ }
30488
+ catch (error) {
30489
+ // One inaccessible adviser must not erase the names and roles of other callable teammates.
30490
+ console.warn(`Failed to resolve TEAM profile for ${teammate.url}:`, error);
30463
30491
  }
30464
30492
  }
30465
30493
  return {
@@ -31406,6 +31434,12 @@
31406
31434
  const parseResult = parseAgentSourceWithCommitments(agentSource);
31407
31435
  const filteredCommitments = filterCommitmentsForAgentModelRequirements(parseResult.commitments);
31408
31436
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
31437
+ if (options === null || options === void 0 ? void 0 : options.isTeamToolRegistrationDisabled) {
31438
+ requirements = {
31439
+ ...requirements,
31440
+ _metadata: { ...requirements._metadata, isTeamToolRegistrationDisabled: true },
31441
+ };
31442
+ }
31409
31443
  requirements = await applyCommitmentsToAgentModelRequirements(requirements, filteredCommitments, options);
31410
31444
  requirements = await augmentAgentModelRequirementsFromSource(requirements, parseResult, agentSource);
31411
31445
  requirements = await materializeInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);