@project-ajax/sdk 0.0.37 → 0.0.49

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.
@@ -3,6 +3,7 @@ type JSONValue = string | number | boolean | null | JSONValue[] | {
3
3
  [key: string]: JSONValue;
4
4
  };
5
5
  export interface ToolConfiguration<I extends JSONValue, O extends JSONValue = JSONValue> {
6
+ title: string;
6
7
  description: string;
7
8
  schema: JSONSchemaType<I>;
8
9
  outputSchema?: JSONSchemaType<O>;
@@ -45,6 +46,7 @@ export declare class ToolExecutionError extends Error {
45
46
  *
46
47
  * ```ts
47
48
  * tool<{ name: string }>({
49
+ * title: "Say Hello",
48
50
  * description: "Say hello to the user",
49
51
  * schema: {
50
52
  * type: "object",
@@ -65,6 +67,7 @@ export declare class ToolExecutionError extends Error {
65
67
  export declare function tool<I extends JSONValue, O extends JSONValue = JSONValue>(config: ToolConfiguration<I, O>): {
66
68
  _tag: string;
67
69
  config: {
70
+ title: string;
68
71
  description: string;
69
72
  schema: JSONSchemaType<I>;
70
73
  outputSchema: JSONSchemaType<O> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/capabilities/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE/C,KAAK,SAAS,GACX,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEhC,MAAM,WAAW,iBAAiB,CACjC,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,GAAG,SAAS;IAE/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,YAAY,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,EAAE,CAAC,KAAK,E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cAAc,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;IAK3B,MAAM;;;;CAMN;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;IAK3B,MAAM;;;;CAMN;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;IAK3B,MAAM;;;;CAMN;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,GAAG,SAAS,EACxE,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;mBAgBT,SAAS,GAAG,OAAO,CACrC;QACA,IAAI,EAAE,SAAS,CAAC;QAChB,KAAK,EAAE,CAAC,CAAC;KACR,GACD;QACA,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EACF,qBAAqB,GACrB,sBAAsB,GACtB,kBAAkB,CAAC;KACrB,CACH;EA0DF"}
@@ -42,6 +42,7 @@ function tool(config) {
42
42
  return {
43
43
  _tag: "tool",
44
44
  config: {
45
+ title: config.title,
45
46
  description: config.description,
46
47
  schema: config.schema,
47
48
  outputSchema: config.outputSchema
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,wEAwEvB,CAAC"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,wEAuEvB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { baseUrl } from "../api/client.js";
2
2
  import { buildHandler } from "../handler.js";
3
- import { openNotionUrl } from "../utils/openNotionUrl.js";
3
+ import { openNotionUrl } from "../utils/openUrl.js";
4
4
  const login = buildHandler(async function(flags, token) {
5
5
  const environment = flags.env ?? "prod";
6
6
  if (flags["base-url"]) {
@@ -27,8 +27,7 @@ const authCommands = buildRouteMap({
27
27
  kind: "enum",
28
28
  values: Environments,
29
29
  brief: "The environment to use for the command",
30
- optional: true,
31
- hidden: true
30
+ optional: true
32
31
  },
33
32
  "base-url": {
34
33
  kind: "parsed",
@@ -1,6 +1,6 @@
1
1
  import { Result } from "../api/result.js";
2
2
  import { buildAuthedHandler } from "../handler.js";
3
- import { openNotionUrl } from "../utils/openNotionUrl.js";
3
+ import { openBrowserUrl } from "../utils/openUrl.js";
4
4
  const listProviders = buildAuthedHandler(async function(flags) {
5
5
  this.process.stderr.write("Fetching providers...");
6
6
  const providersResult = await this.apiClient.listOauthProviders();
@@ -36,7 +36,7 @@ const addConnection = buildAuthedHandler(async function(_flags, provider) {
36
36
  const { authorizationUrl } = startResult.value;
37
37
  this.writer.writeErr("Opening your browser to continue the OAuth flow...");
38
38
  try {
39
- await openNotionUrl(this.config.environment ?? "prod", authorizationUrl);
39
+ await openBrowserUrl(authorizationUrl);
40
40
  } catch (error) {
41
41
  this.writer.writeErr(
42
42
  `Unable to open the browser automatically (${String(
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/cli/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,cAAe,SAAQ,YAAY;IACn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,GAAG,EAAE,EACzE,OAAO,EAAE,CACR,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,KAAK,EACZ,GAAG,IAAI,EAAE,IAAI,KACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,IAGxB,MAAM,YAAY,EAClB,OAAO,WAAW,GAAG,KAAK,EAC1B,GAAG,MAAM,IAAI,mBAgBd;AAED,wBAAgB,kBAAkB,CACjC,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,SAAS,QAAQ,GAAG,EAAE,EAEhC,OAAO,EAAE,CACR,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,KAAK,EACZ,GAAG,IAAI,EAAE,IAAI,KACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,UA5BlB,YAAY,8DAgDnB"}
@@ -2,8 +2,9 @@ import { ApiClient } from "./api/client.js";
2
2
  import { Config } from "./config.js";
3
3
  function buildHandler(handler) {
4
4
  return async function(flags, ...args) {
5
+ const configFilePath = this.process.env.WORKERS_CONFIG_FILE_PATH ?? flags.config ?? "./workers.json";
5
6
  const config = await Config.load({
6
- configFilePath: flags.config ?? "./workers.json",
7
+ configFilePath,
7
8
  processEnv: process.env
8
9
  });
9
10
  this.writer.debugEnabled = flags.debug;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/cli/routes.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,GAAG,0EAgBd,CAAC"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/cli/routes.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,GAAG,0EAgBd,CAAC"}
@@ -11,7 +11,21 @@ import { secretsCommands } from "./commands/secrets.js";
11
11
  import { TokenNotSetError } from "./config.js";
12
12
  const routes = buildRouteMap({
13
13
  docs: {
14
- brief: "A CLI for the Project Ajax platform"
14
+ brief: "A CLI for the Project Ajax platform",
15
+ fullDescription: `
16
+ The Project Ajax CLI is a tool for managing workers, which run code written by
17
+ you, other developers, or AI agents to perform automation tasks, such as syncing
18
+ data, adding slash commands, or performing other actions.
19
+
20
+ Most flags are configured either with a config file or flags, but environment
21
+ variables can also be provided:
22
+
23
+ - WORKERS_CONFIG_FILE_PATH: The path to the config file to use (e.g. ./workers.dev.json)
24
+ - WORKERS_TOKEN: The token to use for authentication
25
+ - WORKERS_ENVIRONMENT: The environment to use
26
+ - WORKERS_WORKER_ID: The worker ID to use
27
+ - WORKERS_BASE_URL: The base API URL to use
28
+ `.trim()
15
29
  },
16
30
  routes: {
17
31
  auth: authCommands,
@@ -1,3 +1,4 @@
1
1
  import type { Environment } from "../config.js";
2
+ export declare function openBrowserUrl(url: string): Promise<void>;
2
3
  export declare function openNotionUrl(env: Environment, url: string): Promise<void>;
3
- //# sourceMappingURL=openNotionUrl.d.ts.map
4
+ //# sourceMappingURL=openUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openUrl.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/openUrl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAc/D;AAED,wBAAsB,aAAa,CAClC,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAgBf"}
@@ -1,15 +1,10 @@
1
1
  import { exec } from "node:child_process";
2
2
  import { existsSync } from "node:fs";
3
- async function openNotionUrl(env, url) {
3
+ async function openBrowserUrl(url) {
4
4
  const platform = process.platform;
5
5
  try {
6
6
  if (platform === "darwin") {
7
- const appName = preferredNotionApp(env);
8
- if (appName) {
9
- exec(`open -a "${appName}" "${url}"`);
10
- } else {
11
- exec(`open "${url}"`);
12
- }
7
+ exec(`open "${url}"`);
13
8
  } else if (platform === "win32") {
14
9
  exec(`start "" "${url}"`);
15
10
  } else {
@@ -19,6 +14,20 @@ async function openNotionUrl(env, url) {
19
14
  throw new Error(`Failed to open browser: ${error}`);
20
15
  }
21
16
  }
17
+ async function openNotionUrl(env, url) {
18
+ const platform = process.platform;
19
+ if (platform === "darwin") {
20
+ const appName = preferredNotionApp(env);
21
+ if (appName) {
22
+ try {
23
+ exec(`open -a "${appName}" "${url}"`);
24
+ return;
25
+ } catch {
26
+ }
27
+ }
28
+ }
29
+ await openBrowserUrl(url);
30
+ }
22
31
  function preferredNotionApp(env) {
23
32
  if (env === "prod" && existsSync("/Applications/Notion.app")) {
24
33
  return "Notion";
@@ -29,5 +38,6 @@ function preferredNotionApp(env) {
29
38
  return null;
30
39
  }
31
40
  export {
41
+ openBrowserUrl,
32
42
  openNotionUrl
33
43
  };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@project-ajax/sdk",
3
- "version": "0.0.37",
3
+ "version": "0.0.49",
4
4
  "description": "An SDK for building workers for the Project Ajax platform",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
7
7
  "bin": {
8
- "workers": "./dist/cli/bin/cli.js"
8
+ "workers": "dist/cli/bin/cli.js"
9
9
  },
10
10
  "exports": {
11
11
  ".": {
@@ -9,6 +9,7 @@ import {
9
9
  describe("tool", () => {
10
10
  it("sync execution", async () => {
11
11
  const myTool = tool<{ name: string }, string>({
12
+ title: "Say Hello",
12
13
  description: "Greet a user",
13
14
  schema: {
14
15
  type: "object",
@@ -33,6 +34,7 @@ describe("tool", () => {
33
34
 
34
35
  it("async execution", async () => {
35
36
  const myTool = tool<{ id: number }, { data: string }>({
37
+ title: "Fetch Data",
36
38
  description: "Fetch data asynchronously",
37
39
  schema: {
38
40
  type: "object",
@@ -59,6 +61,7 @@ describe("tool", () => {
59
61
 
60
62
  it("execution error", async () => {
61
63
  const myTool = tool<Record<string, never>, string>({
64
+ title: "Throw Error",
62
65
  description: "Throws an error",
63
66
  schema: {
64
67
  type: "object",
@@ -82,6 +85,7 @@ describe("tool", () => {
82
85
 
83
86
  it("invalid input", async () => {
84
87
  const myTool = tool<{ name: string }, string>({
88
+ title: "Say Hello",
85
89
  description: "Requires a name property",
86
90
  schema: {
87
91
  type: "object",
@@ -107,7 +111,7 @@ describe("tool", () => {
107
111
 
108
112
  it("invalid output", async () => {
109
113
  const myTool = tool<Record<string, never>, { result: string }>({
110
- name: "returnInvalidOutput",
114
+ title: "Return Invalid Output",
111
115
  description: "Returns output that doesn't match schema",
112
116
  schema: {
113
117
  type: "object",
@@ -143,7 +147,7 @@ describe("tool", () => {
143
147
  { value: number },
144
148
  { doubled: number; message: string }
145
149
  >({
146
- name: "customOutput",
150
+ title: "Custom Output",
147
151
  description: "Has custom output schema",
148
152
  schema: {
149
153
  type: "object",
@@ -12,6 +12,7 @@ export interface ToolConfiguration<
12
12
  I extends JSONValue,
13
13
  O extends JSONValue = JSONValue,
14
14
  > {
15
+ title: string;
15
16
  description: string;
16
17
  schema: JSONSchemaType<I>;
17
18
  outputSchema?: JSONSchemaType<O>;
@@ -76,6 +77,7 @@ export class ToolExecutionError extends Error {
76
77
  *
77
78
  * ```ts
78
79
  * tool<{ name: string }>({
80
+ * title: "Say Hello",
79
81
  * description: "Say hello to the user",
80
82
  * schema: {
81
83
  * type: "object",
@@ -105,6 +107,7 @@ export function tool<I extends JSONValue, O extends JSONValue = JSONValue>(
105
107
  return {
106
108
  _tag: "tool",
107
109
  config: {
110
+ title: config.title,
108
111
  description: config.description,
109
112
  schema: config.schema,
110
113
  outputSchema: config.outputSchema,
@@ -1,7 +1,7 @@
1
1
  import { baseUrl } from "../api/client.js";
2
2
  import type { Environment } from "../config.js";
3
3
  import { buildHandler, type HandlerContext } from "../handler.js";
4
- import { openNotionUrl } from "../utils/openNotionUrl.js";
4
+ import { openNotionUrl } from "../utils/openUrl.js";
5
5
 
6
6
  interface LoginFlags {
7
7
  env?: Environment;
@@ -31,7 +31,6 @@ export const authCommands = buildRouteMap({
31
31
  values: Environments,
32
32
  brief: "The environment to use for the command",
33
33
  optional: true,
34
- hidden: true,
35
34
  },
36
35
  "base-url": {
37
36
  kind: "parsed",
@@ -2,7 +2,7 @@ import type { ApiError } from "../api/client.js";
2
2
  import { Result } from "../api/result.js";
3
3
  import type { FormatFlags, GlobalFlags } from "../flags.js";
4
4
  import { type AuthedContext, buildAuthedHandler } from "../handler.js";
5
- import { openNotionUrl } from "../utils/openNotionUrl.js";
5
+ import { openBrowserUrl } from "../utils/openUrl.js";
6
6
 
7
7
  export const listProviders = buildAuthedHandler(async function (
8
8
  flags: FormatFlags,
@@ -52,7 +52,7 @@ export const addConnection = buildAuthedHandler(async function (
52
52
 
53
53
  this.writer.writeErr("Opening your browser to continue the OAuth flow...");
54
54
  try {
55
- await openNotionUrl(this.config.environment ?? "prod", authorizationUrl);
55
+ await openBrowserUrl(authorizationUrl);
56
56
  } catch (error) {
57
57
  this.writer.writeErr(
58
58
  `Unable to open the browser automatically (${String(
@@ -24,8 +24,13 @@ export function buildHandler<const FLAGS, const ARGS extends BaseArgs = []>(
24
24
  flags: GlobalFlags & FLAGS,
25
25
  ...args: ARGS
26
26
  ) {
27
+ const configFilePath =
28
+ this.process.env.WORKERS_CONFIG_FILE_PATH ??
29
+ flags.config ??
30
+ "./workers.json";
31
+
27
32
  const config = await Config.load({
28
- configFilePath: flags.config ?? "./workers.json",
33
+ configFilePath,
29
34
  processEnv: process.env,
30
35
  });
31
36
 
package/src/cli/routes.ts CHANGED
@@ -13,6 +13,20 @@ import { TokenNotSetError } from "./config.js";
13
13
  const routes = buildRouteMap({
14
14
  docs: {
15
15
  brief: "A CLI for the Project Ajax platform",
16
+ fullDescription: `
17
+ The Project Ajax CLI is a tool for managing workers, which run code written by
18
+ you, other developers, or AI agents to perform automation tasks, such as syncing
19
+ data, adding slash commands, or performing other actions.
20
+
21
+ Most flags are configured either with a config file or flags, but environment
22
+ variables can also be provided:
23
+
24
+ - WORKERS_CONFIG_FILE_PATH: The path to the config file to use (e.g. ./workers.dev.json)
25
+ - WORKERS_TOKEN: The token to use for authentication
26
+ - WORKERS_ENVIRONMENT: The environment to use
27
+ - WORKERS_WORKER_ID: The worker ID to use
28
+ - WORKERS_BASE_URL: The base API URL to use
29
+ `.trim(),
16
30
  },
17
31
  routes: {
18
32
  auth: authCommands,
@@ -3,20 +3,12 @@ import { existsSync } from "node:fs";
3
3
 
4
4
  import type { Environment } from "../config.js";
5
5
 
6
- export async function openNotionUrl(
7
- env: Environment,
8
- url: string,
9
- ): Promise<void> {
6
+ export async function openBrowserUrl(url: string): Promise<void> {
10
7
  const platform = process.platform;
11
8
 
12
9
  try {
13
10
  if (platform === "darwin") {
14
- const appName = preferredNotionApp(env);
15
- if (appName) {
16
- exec(`open -a "${appName}" "${url}"`);
17
- } else {
18
- exec(`open "${url}"`);
19
- }
11
+ exec(`open "${url}"`);
20
12
  } else if (platform === "win32") {
21
13
  exec(`start "" "${url}"`);
22
14
  } else {
@@ -27,6 +19,27 @@ export async function openNotionUrl(
27
19
  }
28
20
  }
29
21
 
22
+ export async function openNotionUrl(
23
+ env: Environment,
24
+ url: string,
25
+ ): Promise<void> {
26
+ const platform = process.platform;
27
+
28
+ if (platform === "darwin") {
29
+ const appName = preferredNotionApp(env);
30
+ if (appName) {
31
+ try {
32
+ exec(`open -a "${appName}" "${url}"`);
33
+ return;
34
+ } catch {
35
+ // Fall back to the default browser below.
36
+ }
37
+ }
38
+ }
39
+
40
+ await openBrowserUrl(url);
41
+ }
42
+
30
43
  function preferredNotionApp(env: Environment): string | null {
31
44
  if (env === "prod" && existsSync("/Applications/Notion.app")) {
32
45
  return "Notion";
@@ -1 +0,0 @@
1
- {"version":3,"file":"openNotionUrl.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/openNotionUrl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAsB,aAAa,CAClC,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAmBf"}