@ct-agents/prompts 0.0.1 → 0.0.2

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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/index.ts +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ct-agents/prompts",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "zod": "4.4.3",
14
- "@ct-agents/protocol": "0.0.1",
15
- "@ct-agents/store": "0.0.1"
14
+ "@ct-agents/store": "0.0.2",
15
+ "@ct-agents/protocol": "0.0.2"
16
16
  },
17
17
  "publishConfig": {
18
18
  "access": "public"
package/src/index.ts CHANGED
@@ -501,6 +501,20 @@ export class DefaultPromptRegistry implements PromptRegistry {
501
501
  .join('\n--------------\n');
502
502
  }
503
503
 
504
+ async hasPromptReference(input: { appId?: string; id: string }) {
505
+ if (input.id.startsWith('fragment:')) {
506
+ const fragment = await this.dependencies.store.get(input.id.slice('fragment:'.length));
507
+ return Boolean(
508
+ fragment?.enabled
509
+ && (!input.appId || fragment.appId === input.appId || fragment.appId === null),
510
+ );
511
+ }
512
+ if (input.id.startsWith('generator:')) {
513
+ return Boolean(this.generators.get(input.id.slice('generator:'.length)));
514
+ }
515
+ return false;
516
+ }
517
+
504
518
  async listPromptFragments(query?: Parameters<PromptFragmentStore['list']>[0]) {
505
519
  const persisted = await this.dependencies.store.list(query);
506
520
  return [...persisted];