@fungi.computer/oyster 0.41.0 → 0.42.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.
@@ -665,6 +665,16 @@ export declare const agentFrameMethods: {
665
665
  };
666
666
  };
667
667
  AGENTS: {
668
+ list: {
669
+ decodeArgs: (raw: readonly unknown[]) => [(Record<string, never> | undefined)?];
670
+ decodeResult: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => {
671
+ readonly agents: readonly {
672
+ readonly agentId: string;
673
+ readonly name: string;
674
+ }[];
675
+ };
676
+ requiredOperations: () => string[];
677
+ };
668
678
  schedules: {
669
679
  decodeArgs: (raw: readonly unknown[]) => [{
670
680
  limit: number;
@@ -2816,6 +2816,7 @@ const agentBindingArgs = {
2816
2816
  visit: z.tuple([agentTarget]),
2817
2817
  },
2818
2818
  AGENTS: {
2819
+ list: z.tuple([z.strictObject({}).optional()]),
2819
2820
  send: z.tuple([
2820
2821
  agentTarget.extend({
2821
2822
  requestId: z
@@ -2844,6 +2845,13 @@ const decodeInboxVisit = Schema.decodeUnknownSync(inboxVisitSchema, {
2844
2845
  const decodeAgentAccepted = Schema.decodeUnknownSync(AcceptedSchema, {
2845
2846
  onExcessProperty: "error",
2846
2847
  });
2848
+ /** Ids and display names only, as Hub's `agent.list` returns. */
2849
+ const agentListSchema = Schema.Struct({
2850
+ agents: Schema.Array(Schema.Struct({ agentId: Schema.String, name: Schema.String })),
2851
+ });
2852
+ const decodeAgentList = Schema.decodeUnknownSync(agentListSchema, {
2853
+ onExcessProperty: "error",
2854
+ });
2847
2855
  /** Shared packet codecs; the Instance alone admits the current frame's operations. */
2848
2856
  export const agentFrameMethods = {
2849
2857
  INBOX: {
@@ -2863,6 +2871,11 @@ export const agentFrameMethods = {
2863
2871
  },
2864
2872
  },
2865
2873
  AGENTS: {
2874
+ list: {
2875
+ decodeArgs: (raw) => agentBindingArgs.AGENTS.list.parse(raw),
2876
+ decodeResult: decodeAgentList,
2877
+ requiredOperations: () => ["list"],
2878
+ },
2866
2879
  schedules: {
2867
2880
  decodeArgs: (raw) => agentScheduleBindingArgs.schedules.parse(raw),
2868
2881
  decodeResult: Schema.decodeUnknownSync(agentSchedulePageSchema, {
@@ -2952,6 +2965,18 @@ export async function dispatchAgentBinding(env, scope, frame, props, method, arg
2952
2965
  await directory.visit(input.agentId, input.sessionId);
2953
2966
  result = { visited: true };
2954
2967
  }
2968
+ else if (props.binding === "AGENTS" && method === "list") {
2969
+ agentBindingArgs.AGENTS.list.parse(args);
2970
+ const listable = admitted.authority.approvedGrants.find((grant) => grant.capability === "agent.list");
2971
+ if (listable === undefined)
2972
+ throw new AppInstanceError("binding_not_granted");
2973
+ const ceiling = agentCeiling(listable.resources);
2974
+ result = {
2975
+ agents: (await directory.list())
2976
+ .filter(({ agentId }) => ceiling === "all" || ceiling.has(agentId))
2977
+ .map(({ agentId, name }) => ({ agentId, name })),
2978
+ };
2979
+ }
2955
2980
  else if (props.binding === "AGENTS" && method === "send") {
2956
2981
  const [input] = agentBindingArgs.AGENTS.send.parse(args);
2957
2982
  if (!(await directory.has(input.agentId)))
@@ -3007,6 +3032,7 @@ export async function dispatchAgentBinding(env, scope, frame, props, method, arg
3007
3032
  inboxPageSchema,
3008
3033
  inboxVisitSchema,
3009
3034
  AcceptedSchema,
3035
+ agentListSchema,
3010
3036
  agentSchedulePageSchema,
3011
3037
  agentScheduleControlReceiptSchema,
3012
3038
  ]), { onExcessProperty: "error" })(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Oyster by Fungi: open-source Apps for people and AI agents. Try with one command or run on your own Cloudflare account.",
6
6
  "homepage": "https://docs.fungi.computer/oyster",
@@ -387,7 +387,7 @@
387
387
  "@fungi.computer/veil": "0.8.2",
388
388
  "@fungi.computer/watchdog": "0.1.4",
389
389
  "@fungi.computer/whistle": "0.3.0",
390
- "@fungi.computer/workflows-wire": "0.6.0",
390
+ "@fungi.computer/workflows-wire": "0.7.0",
391
391
  "@fungi.computer/zookeeper": "0.0.43",
392
392
  "@jellybrick/dbus-next": "0.11.4",
393
393
  "@modelcontextprotocol/server": "2.0.0",